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

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

Issue 1806643002: Revert of Remove V8RecrusionScope, cleanup call sites. (patchset #8 id:140001 of https://codereview… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverts 1805543002 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(v8::Local<v8::Function Template> constructorTemplate, v8::Local<v8::Context> context) 35 v8::Local<v8::Object> InspectorWrapperBase::createWrapper(V8DebuggerClient* clie nt, v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context)
36 { 36 {
37 v8::MicrotasksScope microtasks(context->GetIsolate(), v8::MicrotasksScope::k DoNotRunMicrotasks);
38 v8::Local<v8::Function> function; 37 v8::Local<v8::Function> function;
39 if (!constructorTemplate->GetFunction(context).ToLocal(&function)) 38 if (!constructorTemplate->GetFunction(context).ToLocal(&function))
40 return v8::Local<v8::Object>(); 39 return v8::Local<v8::Object>();
41 40
42 v8::Local<v8::Object> result; 41 v8::Local<v8::Object> result;
43 if (!function->NewInstance(context).ToLocal(&result)) 42 if (!client->instantiateObject(function).ToLocal(&result))
44 return v8::Local<v8::Object>(); 43 return v8::Local<v8::Object>();
45 return result; 44 return result;
46 } 45 }
47 46
48 void* InspectorWrapperBase::unwrap(v8::Local<v8::Context> context, v8::Local<v8: :Object> object, const char* name) 47 void* InspectorWrapperBase::unwrap(v8::Local<v8::Context> context, v8::Local<v8: :Object> object, const char* name)
49 { 48 {
50 v8::Isolate* isolate = context->GetIsolate(); 49 v8::Isolate* isolate = context->GetIsolate();
51 ASSERT(context != v8::Debug::GetDebugContext(isolate)); 50 ASSERT(context != v8::Debug::GetDebugContext(isolate));
52 51
53 v8::Local<v8::Private> privateKey = v8::Private::ForApi(isolate, v8::String: :NewFromUtf8(isolate, name, v8::NewStringType::kInternalized).ToLocalChecked()); 52 v8::Local<v8::Private> privateKey = v8::Private::ForApi(isolate, v8::String: :NewFromUtf8(isolate, name, v8::NewStringType::kInternalized).ToLocalChecked());
54 53
55 v8::Local<v8::Value> value; 54 v8::Local<v8::Value> value;
56 if (!object->GetPrivate(context, privateKey).ToLocal(&value)) 55 if (!object->GetPrivate(context, privateKey).ToLocal(&value))
57 return nullptr; 56 return nullptr;
58 if (!value->IsExternal()) 57 if (!value->IsExternal())
59 return nullptr; 58 return nullptr;
60 return value.As<v8::External>()->Value(); 59 return value.As<v8::External>()->Value();
61 } 60 }
62 61
63 v8::Local<v8::String> InspectorWrapperBase::v8InternalizedString(v8::Isolate* is olate, const char* name) 62 v8::Local<v8::String> InspectorWrapperBase::v8InternalizedString(v8::Isolate* is olate, const char* name)
64 { 63 {
65 return v8::String::NewFromUtf8(isolate, name, v8::NewStringType::kInternaliz ed).ToLocalChecked(); 64 return v8::String::NewFromUtf8(isolate, name, v8::NewStringType::kInternaliz ed).ToLocalChecked();
66 } 65 }
67 66
68 } // namespace blink 67 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698