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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/InspectorWrapper.cpp

Issue 1769273004: Remove V8RecrusionScope, cleanup call sites. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/v8_inspector/InspectorWrapper.h" 5 #include "platform/v8_inspector/InspectorWrapper.h"
6 6
7 #include "platform/v8_inspector/public/V8DebuggerClient.h" 7 #include "platform/v8_inspector/public/V8DebuggerClient.h"
8 8
9 #include <v8-debug.h> 9 #include <v8-debug.h>
10 10
(...skipping 14 matching lines...) Expand all
25 for (auto& config : methods) { 25 for (auto& config : methods) {
26 v8::Local<v8::Name> v8name = v8::String::NewFromUtf8(isolate, config.nam e, v8::NewStringType::kInternalized).ToLocalChecked(); 26 v8::Local<v8::Name> v8name = v8::String::NewFromUtf8(isolate, config.nam e, v8::NewStringType::kInternalized).ToLocalChecked();
27 v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate: :New(isolate, config.callback); 27 v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate: :New(isolate, config.callback);
28 functionTemplate->RemovePrototype(); 28 functionTemplate->RemovePrototype();
29 instanceTemplate->Set(v8name, functionTemplate, static_cast<v8::Property Attribute>(v8::DontDelete | v8::DontEnum | v8::ReadOnly)); 29 instanceTemplate->Set(v8name, functionTemplate, static_cast<v8::Property Attribute>(v8::DontDelete | v8::DontEnum | v8::ReadOnly));
30 } 30 }
31 31
32 return functionTemplate; 32 return functionTemplate;
33 } 33 }
34 34
35 v8::Local<v8::Object> InspectorWrapperBase::createWrapper(V8DebuggerClient* clie nt, v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context) 35 v8::Local<v8::Object> InspectorWrapperBase::createWrapper(v8::Local<v8::Function Template> constructorTemplate, v8::Local<v8::Context> context)
36 { 36 {
37 v8::Local<v8::Function> function; 37 v8::Local<v8::Function> function;
38 if (!constructorTemplate->GetFunction(context).ToLocal(&function)) 38 if (!constructorTemplate->GetFunction(context).ToLocal(&function))
39 return v8::Local<v8::Object>(); 39 return v8::Local<v8::Object>();
40 40
41 v8::Local<v8::Object> result; 41 v8::Local<v8::Object> result;
42 if (!client->instantiateObject(function).ToLocal(&result)) 42 v8::MicrotasksScope microtasksScope(context->GetIsolate(), v8::MicrotasksSco pe::kDoNotRunMicrotasks);
pfeldman 2016/03/08 01:44:20 We don't need microtasks around the injected scrip
dgozman 2016/03/08 02:23:00 Done.
43 if (!function->NewInstance(context).ToLocal(&result))
43 return v8::Local<v8::Object>(); 44 return v8::Local<v8::Object>();
44 return result; 45 return result;
45 } 46 }
46 47
47 void* InspectorWrapperBase::unwrap(v8::Local<v8::Context> context, v8::Local<v8: :Object> object, const char* name) 48 void* InspectorWrapperBase::unwrap(v8::Local<v8::Context> context, v8::Local<v8: :Object> object, const char* name)
48 { 49 {
49 v8::Isolate* isolate = context->GetIsolate(); 50 v8::Isolate* isolate = context->GetIsolate();
50 ASSERT(context != v8::Debug::GetDebugContext(isolate)); 51 ASSERT(context != v8::Debug::GetDebugContext(isolate));
51 52
52 v8::Local<v8::Private> privateKey = v8::Private::ForApi(isolate, v8::String: :NewFromUtf8(isolate, name, v8::NewStringType::kInternalized).ToLocalChecked()); 53 v8::Local<v8::Private> privateKey = v8::Private::ForApi(isolate, v8::String: :NewFromUtf8(isolate, name, v8::NewStringType::kInternalized).ToLocalChecked());
53 54
54 v8::Local<v8::Value> value; 55 v8::Local<v8::Value> value;
55 if (!object->GetPrivate(context, privateKey).ToLocal(&value)) 56 if (!object->GetPrivate(context, privateKey).ToLocal(&value))
56 return nullptr; 57 return nullptr;
57 if (!value->IsExternal()) 58 if (!value->IsExternal())
58 return nullptr; 59 return nullptr;
59 return value.As<v8::External>()->Value(); 60 return value.As<v8::External>()->Value();
60 } 61 }
61 62
62 v8::Local<v8::String> InspectorWrapperBase::v8InternalizedString(v8::Isolate* is olate, const char* name) 63 v8::Local<v8::String> InspectorWrapperBase::v8InternalizedString(v8::Isolate* is olate, const char* name)
63 { 64 {
64 return v8::String::NewFromUtf8(isolate, name, v8::NewStringType::kInternaliz ed).ToLocalChecked(); 65 return v8::String::NewFromUtf8(isolate, name, v8::NewStringType::kInternaliz ed).ToLocalChecked();
65 } 66 }
66 67
67 } // namespace blink 68 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698