X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fbindings%2Fv8%2FV8Utilities.cpp;h=74dcb7ba981d53a34f937285804fe5281f945d15;hb=ff3e2503a20db9193d323c1d19c38c68004dec4a;hp=5dc29ef74543723bdf97c6a868b3cbd56d8a0581;hpb=7338fba38ba696536d1cc9d389afd716a6ab2fe6;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/bindings/v8/V8Utilities.cpp b/src/third_party/WebKit/Source/bindings/v8/V8Utilities.cpp index 5dc29ef..74dcb7b 100644 --- a/src/third_party/WebKit/Source/bindings/v8/V8Utilities.cpp +++ b/src/third_party/WebKit/Source/bindings/v8/V8Utilities.cpp @@ -50,20 +50,6 @@ namespace WebCore { -// Use an array to hold dependents. It works like a ref-counted scheme. -// A value can be added more than once to the DOM object. -void createHiddenDependency(v8::Handle object, v8::Local value, int cacheIndex, v8::Isolate* isolate) -{ - v8::Local cache = object->GetInternalField(cacheIndex); - if (cache->IsNull() || cache->IsUndefined()) { - cache = v8::Array::New(isolate); - object->SetInternalField(cacheIndex, cache); - } - - v8::Local cacheArray = v8::Local::Cast(cache); - cacheArray->Set(v8::Integer::New(isolate, cacheArray->Length()), value); -} - bool extractTransferables(v8::Local value, int argumentIndex, MessagePortArray& ports, ArrayBufferArray& arrayBuffers, ExceptionState& exceptionState, v8::Isolate* isolate) { if (isUndefinedOrNull(value)) { @@ -115,74 +101,4 @@ bool extractTransferables(v8::Local value, int argumentIndex, Message return true; } -bool getMessagePortArray(v8::Local value, const String& propertyName, MessagePortArray& ports, v8::Isolate* isolate) -{ - if (isUndefinedOrNull(value)) { - ports.resize(0); - return true; - } - bool success = false; - ports = toRefPtrNativeArray(value, propertyName, isolate, &success); - return success; -} - -bool getMessagePortArray(v8::Local value, int argumentIndex, MessagePortArray& ports, v8::Isolate* isolate) -{ - if (isUndefinedOrNull(value)) { - ports.resize(0); - return true; - } - bool success = false; - ports = toRefPtrNativeArray(value, argumentIndex, isolate, &success); - return success; -} - -void removeHiddenDependency(v8::Handle object, v8::Local value, int cacheIndex, v8::Isolate* isolate) -{ - v8::Local cache = object->GetInternalField(cacheIndex); - if (!cache->IsArray()) - return; - v8::Local cacheArray = v8::Local::Cast(cache); - for (int i = cacheArray->Length() - 1; i >= 0; --i) { - v8::Local cached = cacheArray->Get(v8::Integer::New(isolate, i)); - if (cached->StrictEquals(value)) { - cacheArray->Delete(i); - return; - } - } -} - -void transferHiddenDependency(v8::Handle object, EventListener* oldValue, v8::Local newValue, int cacheIndex, v8::Isolate* isolate) -{ - if (oldValue) { - V8AbstractEventListener* oldListener = V8AbstractEventListener::cast(oldValue); - if (oldListener) { - v8::Local oldListenerObject = oldListener->getExistingListenerObject(); - if (!oldListenerObject.IsEmpty()) - removeHiddenDependency(object, oldListenerObject, cacheIndex, isolate); - } - } - // Non-callable input is treated as null and ignored - if (newValue->IsFunction()) - createHiddenDependency(object, newValue, cacheIndex, isolate); -} - -ExecutionContext* getExecutionContext() -{ - if (WorkerScriptController* controller = WorkerScriptController::controllerForContext()) - return &controller->workerGlobalScope(); - - return currentDocument(); -} - -v8::Handle getBoundFunction(v8::Handle function) -{ - v8::Handle boundFunction = function->GetBoundFunction(); - if (boundFunction->IsFunction()) { - return v8::Handle::Cast(boundFunction); - } else { - return function; - } -} - } // namespace WebCore