Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Unified Diff: Source/bindings/v8/custom/V8PromiseCustom.cpp

Issue 166173002: Count Promise constructor callings. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/custom/V8PromiseCustom.cpp
diff --git a/Source/bindings/v8/custom/V8PromiseCustom.cpp b/Source/bindings/v8/custom/V8PromiseCustom.cpp
index 66e366818b480da0a7bda3739656916d8076b59c..21f923d92f52a92fce2102d771ac626b8d6fce47 100644
--- a/Source/bindings/v8/custom/V8PromiseCustom.cpp
+++ b/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"
@@ -486,6 +487,8 @@ void V8Promise::constructorCustom(const v8::FunctionCallbackInfo<v8::Value>& inf
{
v8SetReturnValue(info, v8::Local<v8::Value>());
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;
@@ -519,6 +522,8 @@ void V8Promise::thenMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info
void V8Promise::castMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Isolate* isolate = info.GetIsolate();
+ ExecutionContext* executionContext = activeExecutionContext(isolate);
+ UseCounter::count(executionContext, UseCounter::PromiseCast);
v8::Local<v8::Value> result = v8::Undefined(isolate);
if (info.Length() > 0)
result = info[0];
@@ -544,6 +549,8 @@ void V8Promise::catchMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& inf
void V8Promise::resolveMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Isolate* isolate = info.GetIsolate();
+ ExecutionContext* executionContext = activeExecutionContext(isolate);
+ UseCounter::count(executionContext, UseCounter::PromiseResolve);
v8::Local<v8::Value> result = v8::Undefined(isolate);
if (info.Length() > 0)
result = info[0];
@@ -556,6 +563,8 @@ void V8Promise::resolveMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& i
void V8Promise::rejectMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Isolate* isolate = info.GetIsolate();
+ ExecutionContext* executionContext = activeExecutionContext(isolate);
+ UseCounter::count(executionContext, UseCounter::PromiseReject);
v8::Local<v8::Value> result = v8::Undefined(isolate);
if (info.Length() > 0)
result = info[0];
« no previous file with comments | « no previous file | Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698