| OLD | NEW |
| 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/V8InjectedScriptHost.h" | 5 #include "platform/v8_inspector/V8InjectedScriptHost.h" |
| 6 | 6 |
| 7 #include "platform/inspector_protocol/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
| 8 #include "platform/v8_inspector/InjectedScriptNative.h" | 8 #include "platform/v8_inspector/InjectedScriptNative.h" |
| 9 #include "platform/v8_inspector/V8Compat.h" | 9 #include "platform/v8_inspector/V8Compat.h" |
| 10 #include "platform/v8_inspector/V8DebuggerImpl.h" | 10 #include "platform/v8_inspector/V8DebuggerImpl.h" |
| 11 #include "platform/v8_inspector/V8StringUtil.h" | 11 #include "platform/v8_inspector/V8StringUtil.h" |
| 12 #include "platform/v8_inspector/public/V8DebuggerClient.h" | 12 #include "platform/v8_inspector/public/V8DebuggerClient.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 void setFunctionProperty(v8::Local<v8::Context> context, v8::Local<v8::Object> o
bj, const char* name, v8::FunctionCallback callback, v8::Local<v8::External> ext
ernal) | 18 void setFunctionProperty(v8::Local<v8::Context> context, v8::Local<v8::Object> o
bj, const char* name, v8::FunctionCallback callback, v8::Local<v8::External> ext
ernal) |
| 19 { | 19 { |
| 20 v8::Local<v8::String> funcName = toV8StringInternalized(context->GetIsolate(
), name); | 20 v8::Local<v8::String> funcName = toV8StringInternalized(context->GetIsolate(
), name); |
| 21 v8::Local<v8::Function> func; | 21 v8::Local<v8::Function> func; |
| 22 if (!v8::Function::New(context, callback, external, 0, v8::ConstructorBehavi
or::kThrow).ToLocal(&func)) | 22 if (!v8::Function::New(context, callback, external).ToLocal(&func)) |
| 23 return; | 23 return; |
| 24 func->SetName(funcName); | 24 func->SetName(funcName); |
| 25 if (!obj->Set(context, funcName, func).FromMaybe(false)) | 25 if (!obj->Set(context, funcName, func).FromMaybe(false)) |
| 26 return; | 26 return; |
| 27 } | 27 } |
| 28 | 28 |
| 29 V8DebuggerImpl* unwrapDebugger(const v8::FunctionCallbackInfo<v8::Value>& info) | 29 V8DebuggerImpl* unwrapDebugger(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 30 { | 30 { |
| 31 DCHECK(!info.Data().IsEmpty()); | 31 DCHECK(!info.Data().IsEmpty()); |
| 32 DCHECK(info.Data()->IsExternal()); | 32 DCHECK(info.Data()->IsExternal()); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 info.GetReturnValue().Set(target); | 222 info.GetReturnValue().Set(target); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void V8InjectedScriptHost::prototypeCallback(const v8::FunctionCallbackInfo<v8::
Value>& info) | 225 void V8InjectedScriptHost::prototypeCallback(const v8::FunctionCallbackInfo<v8::
Value>& info) |
| 226 { | 226 { |
| 227 DCHECK(info.Length() > 0 && info[0]->IsObject()); | 227 DCHECK(info.Length() > 0 && info[0]->IsObject()); |
| 228 info.GetReturnValue().Set(info[0].As<v8::Object>()->GetPrototype()); | 228 info.GetReturnValue().Set(info[0].As<v8::Object>()->GetPrototype()); |
| 229 } | 229 } |
| 230 | 230 |
| 231 } // namespace blink | 231 } // namespace blink |
| OLD | NEW |