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