X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fbindings%2Fv8%2Fcustom%2FV8PromiseCustom.cpp;h=21f923d92f52a92fce2102d771ac626b8d6fce47;hb=ff3e2503a20db9193d323c1d19c38c68004dec4a;hp=be95b44f38b44af24de29be89d6300c841ec3240;hpb=7338fba38ba696536d1cc9d389afd716a6ab2fe6;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/bindings/v8/custom/V8PromiseCustom.cpp b/src/third_party/WebKit/Source/bindings/v8/custom/V8PromiseCustom.cpp index be95b44f..21f923d 100644 --- a/src/third_party/WebKit/Source/bindings/v8/custom/V8PromiseCustom.cpp +++ b/src/third_party/WebKit/Source/bindings/v8/custom/V8PromiseCustom.cpp @@ -44,6 +44,7 @@ #include "core/dom/Document.h" #include "core/dom/ExecutionContextTask.h" #include "core/frame/DOMWindow.h" +#include "core/frame/UseCounter.h" #include "core/inspector/InspectorInstrumentation.h" #include "core/workers/WorkerGlobalScope.h" #include "platform/Task.h" @@ -458,7 +459,7 @@ void PromisePropagator::updateDerived(v8::Handle derivedPromise, v8: v8::Local originatorValue = originatorInternal->GetInternalField(V8PromiseCustom::InternalResultIndex); if (originatorState == V8PromiseCustom::Fulfilled) { if (originatorValue->IsObject()) { - ExecutionContext* executionContext = getExecutionContext(); + ExecutionContext* executionContext = currentExecutionContext(isolate); ASSERT(executionContext && executionContext->isContextThread()); executionContext->postTask(adoptPtr(new UpdateDerivedTask(derivedPromise, onFulfilled, onRejected, originatorValue.As(), isolate, executionContext))); } else { @@ -486,6 +487,8 @@ void V8Promise::constructorCustom(const v8::FunctionCallbackInfo& inf { v8SetReturnValue(info, v8::Local()); v8::Isolate* isolate = info.GetIsolate(); + ExecutionContext* executionContext = activeExecutionContext(isolate); + UseCounter::count(executionContext, UseCounter::PromiseConstructor); if (!info.Length() || !info[0]->IsFunction()) { throwTypeError("Promise constructor takes a function argument", isolate); return; @@ -497,7 +500,7 @@ void V8Promise::constructorCustom(const v8::FunctionCallbackInfo& inf createClosure(promiseRejectCallback, promise, isolate) }; v8::TryCatch trycatch; - if (V8ScriptRunner::callFunction(init, getExecutionContext(), v8::Undefined(isolate), WTF_ARRAY_LENGTH(argv), argv, isolate).IsEmpty()) { + if (V8ScriptRunner::callFunction(init, currentExecutionContext(isolate), v8::Undefined(isolate), WTF_ARRAY_LENGTH(argv), argv, isolate).IsEmpty()) { // An exception is thrown. Reject the promise if its resolved flag is unset. V8PromiseCustom::reject(promise, trycatch.Exception(), isolate); } @@ -519,6 +522,8 @@ void V8Promise::thenMethodCustom(const v8::FunctionCallbackInfo& info void V8Promise::castMethodCustom(const v8::FunctionCallbackInfo& info) { v8::Isolate* isolate = info.GetIsolate(); + ExecutionContext* executionContext = activeExecutionContext(isolate); + UseCounter::count(executionContext, UseCounter::PromiseCast); v8::Local result = v8::Undefined(isolate); if (info.Length() > 0) result = info[0]; @@ -544,6 +549,8 @@ void V8Promise::catchMethodCustom(const v8::FunctionCallbackInfo& inf void V8Promise::resolveMethodCustom(const v8::FunctionCallbackInfo& info) { v8::Isolate* isolate = info.GetIsolate(); + ExecutionContext* executionContext = activeExecutionContext(isolate); + UseCounter::count(executionContext, UseCounter::PromiseResolve); v8::Local result = v8::Undefined(isolate); if (info.Length() > 0) result = info[0]; @@ -556,6 +563,8 @@ void V8Promise::resolveMethodCustom(const v8::FunctionCallbackInfo& i void V8Promise::rejectMethodCustom(const v8::FunctionCallbackInfo& info) { v8::Isolate* isolate = info.GetIsolate(); + ExecutionContext* executionContext = activeExecutionContext(isolate); + UseCounter::count(executionContext, UseCounter::PromiseReject); v8::Local result = v8::Undefined(isolate); if (info.Length() > 0) result = info[0]; @@ -798,7 +807,7 @@ v8::Local V8PromiseCustom::coerceThenable(v8::Handle the createClosure(promiseRejectCallback, promise, isolate) }; v8::TryCatch trycatch; - if (V8ScriptRunner::callFunction(then, getExecutionContext(), thenable, WTF_ARRAY_LENGTH(argv), argv, isolate).IsEmpty()) { + if (V8ScriptRunner::callFunction(then, currentExecutionContext(isolate), thenable, WTF_ARRAY_LENGTH(argv), argv, isolate).IsEmpty()) { reject(promise, trycatch.Exception(), isolate); } setHiddenValue(isolate, thenable, "thenableHiddenPromise", promise); @@ -808,7 +817,7 @@ v8::Local V8PromiseCustom::coerceThenable(v8::Handle the void V8PromiseCustom::callHandler(v8::Handle promise, v8::Handle handler, v8::Handle argument, PromiseState originatorState, v8::Isolate* isolate) { ASSERT(originatorState == Fulfilled || originatorState == Rejected); - ExecutionContext* executionContext = getExecutionContext(); + ExecutionContext* executionContext = currentExecutionContext(isolate); ASSERT(executionContext && executionContext->isContextThread()); executionContext->postTask(adoptPtr(new CallHandlerTask(promise, handler, argument, originatorState, isolate, executionContext))); }