| 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/V8Debugger.h" | 10 #include "platform/v8_inspector/V8Debugger.h" |
| 11 #include "platform/v8_inspector/V8InspectorImpl.h" | 11 #include "platform/v8_inspector/V8InspectorImpl.h" |
| 12 #include "platform/v8_inspector/V8InternalValueType.h" | 12 #include "platform/v8_inspector/V8InternalValueType.h" |
| 13 #include "platform/v8_inspector/V8StringUtil.h" | 13 #include "platform/v8_inspector/V8StringUtil.h" |
| 14 #include "platform/v8_inspector/public/V8InspectorClient.h" | 14 #include "platform/v8_inspector/public/V8InspectorClient.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 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) | 20 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) |
| 21 { | 21 { |
| 22 v8::Local<v8::String> funcName = toV8StringInternalized(context->GetIsolate(
), name); | 22 v8::Local<v8::String> funcName = toV8StringInternalized(context->GetIsolate(
), name); |
| 23 v8::Local<v8::Function> func; | 23 v8::Local<v8::Function> func; |
| 24 if (!v8::Function::New(context, callback, external, 0, v8::ConstructorBehavi
or::kThrow).ToLocal(&func)) | 24 if (!V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, callback, external, 0).ToLoca
l(&func)) |
| 25 return; | 25 return; |
| 26 func->SetName(funcName); | 26 func->SetName(funcName); |
| 27 if (!obj->Set(context, funcName, func).FromMaybe(false)) | 27 if (!obj->Set(context, funcName, func).FromMaybe(false)) |
| 28 return; | 28 return; |
| 29 } | 29 } |
| 30 | 30 |
| 31 V8InspectorImpl* unwrapInspector(const v8::FunctionCallbackInfo<v8::Value>& info
) | 31 V8InspectorImpl* unwrapInspector(const v8::FunctionCallbackInfo<v8::Value>& info
) |
| 32 { | 32 { |
| 33 DCHECK(!info.Data().IsEmpty()); | 33 DCHECK(!info.Data().IsEmpty()); |
| 34 DCHECK(info.Data()->IsExternal()); | 34 DCHECK(info.Data()->IsExternal()); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 NOTREACHED(); | 177 NOTREACHED(); |
| 178 return; | 178 return; |
| 179 } | 179 } |
| 180 v8::Local<v8::Object> target = info[0].As<v8::Proxy>(); | 180 v8::Local<v8::Object> target = info[0].As<v8::Proxy>(); |
| 181 while (target->IsProxy()) | 181 while (target->IsProxy()) |
| 182 target = v8::Local<v8::Proxy>::Cast(target)->GetTarget(); | 182 target = v8::Local<v8::Proxy>::Cast(target)->GetTarget(); |
| 183 info.GetReturnValue().Set(target); | 183 info.GetReturnValue().Set(target); |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace blink | 186 } // namespace blink |
| OLD | NEW |