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

Side by Side Diff: Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp

Issue 18169002: Improve Dart Debugger performance and robustness by creating Dart wrappers using the standard SetNa… (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: code review fixes Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007-2011 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 27 matching lines...) Expand all
38 #include "V8Int16Array.h" 38 #include "V8Int16Array.h"
39 #include "V8Int32Array.h" 39 #include "V8Int32Array.h"
40 #include "V8Int8Array.h" 40 #include "V8Int8Array.h"
41 #include "V8Node.h" 41 #include "V8Node.h"
42 #include "V8NodeList.h" 42 #include "V8NodeList.h"
43 #include "V8Storage.h" 43 #include "V8Storage.h"
44 #include "V8Uint16Array.h" 44 #include "V8Uint16Array.h"
45 #include "V8Uint32Array.h" 45 #include "V8Uint32Array.h"
46 #include "V8Uint8Array.h" 46 #include "V8Uint8Array.h"
47 #include "V8Uint8ClampedArray.h" 47 #include "V8Uint8ClampedArray.h"
48 #include "bindings/dart/DartHandleProxy.h"
48 #include "bindings/tests/results/V8Float64Array.h" 49 #include "bindings/tests/results/V8Float64Array.h"
49 #include "bindings/v8/BindingSecurity.h" 50 #include "bindings/v8/BindingSecurity.h"
50 #include "bindings/v8/ScriptDebugServer.h" 51 #include "bindings/v8/ScriptDebugServer.h"
51 #include "bindings/v8/ScriptValue.h" 52 #include "bindings/v8/ScriptValue.h"
52 #include "bindings/v8/V8AbstractEventListener.h" 53 #include "bindings/v8/V8AbstractEventListener.h"
53 #include "bindings/v8/V8Binding.h" 54 #include "bindings/v8/V8Binding.h"
54 #include "bindings/v8/V8HiddenPropertyName.h" 55 #include "bindings/v8/V8HiddenPropertyName.h"
55 #include "bindings/v8/V8ScriptRunner.h" 56 #include "bindings/v8/V8ScriptRunner.h"
56 #include "core/inspector/InjectedScript.h" 57 #include "core/inspector/InjectedScript.h"
57 #include "core/inspector/InjectedScriptHost.h" 58 #include "core/inspector/InjectedScriptHost.h"
58 #include "core/inspector/InspectorDOMAgent.h" 59 #include "core/inspector/InspectorDOMAgent.h"
59 #include "core/inspector/InspectorValues.h" 60 #include "core/inspector/InspectorValues.h"
60 #include "modules/webdatabase/Database.h" 61 #include "modules/webdatabase/Database.h"
61 62
62 namespace WebCore { 63 namespace WebCore {
63 64
64 Node* InjectedScriptHost::scriptValueAsNode(ScriptValue value) 65 Node* InjectedScriptHost::scriptValueAsNode(ScriptValue value)
65 { 66 {
67 v8::HandleScope scope;
66 if (!value.isObject() || value.isNull()) 68 if (!value.isObject() || value.isNull())
67 return 0; 69 return 0;
68 return V8Node::toNative(v8::Handle<v8::Object>::Cast(value.v8ValueRaw())); 70
71 v8::Handle<v8::Object> handle = v8::Handle<v8::Object>::Cast(value.v8ValueRa w());
Anton Muhin 2013/07/16 13:27:40 it might be not a restriction now, but we tried re
Jacob 2013/07/16 16:44:59 My impression is that restriction has been lifted
72 if (DartHandleProxy::isDartProxy(handle))
73 return DartHandleProxy::toNativeNode(handle);
74
75 return V8Node::toNative(handle);
69 } 76 }
70 77
71 ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* state, Node* node ) 78 ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* state, Node* node )
72 { 79 {
73 v8::HandleScope scope; 80 v8::HandleScope scope;
74 v8::Local<v8::Context> context = state->context(); 81 v8::Local<v8::Context> context = state->context();
75 v8::Context::Scope contextScope(context); 82 v8::Context::Scope contextScope(context);
76 83
77 if (!BindingSecurity::shouldAllowAccessToNode(node)) 84 if (!BindingSecurity::shouldAllowAccessToNode(node))
78 return ScriptValue(v8::Null()); 85 return ScriptValue(v8::Null());
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 return; 177 return;
171 } 178 }
172 if (V8Float32Array::HasInstance(value, args.GetIsolate(), currentWorldType) || V8Float64Array::HasInstance(value, args.GetIsolate(), currentWorldType)) { 179 if (V8Float32Array::HasInstance(value, args.GetIsolate(), currentWorldType) || V8Float64Array::HasInstance(value, args.GetIsolate(), currentWorldType)) {
173 v8SetReturnValue(args, v8::String::NewSymbol("array")); 180 v8SetReturnValue(args, v8::String::NewSymbol("array"));
174 return; 181 return;
175 } 182 }
176 if (V8Uint8ClampedArray::HasInstance(value, args.GetIsolate(), currentWorldT ype)) { 183 if (V8Uint8ClampedArray::HasInstance(value, args.GetIsolate(), currentWorldT ype)) {
177 v8SetReturnValue(args, v8::String::NewSymbol("array")); 184 v8SetReturnValue(args, v8::String::NewSymbol("array"));
178 return; 185 return;
179 } 186 }
187 if (DartHandleProxy::isDartProxy(value)) {
188 const char* type = DartHandleProxy::getType(value);
189 if (type)
190 v8SetReturnValue(args, v8::String::NewSymbol(type));
191 return;
192 }
180 } 193 }
181 194
182 void V8InjectedScriptHost::functionDetailsMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& args) 195 void V8InjectedScriptHost::functionDetailsMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& args)
183 { 196 {
184 if (args.Length() < 1) 197 if (args.Length() < 1)
185 return; 198 return;
186 199
187 v8::Handle<v8::Value> value = args[0]; 200 v8::Handle<v8::Value> value = args[0];
188 if (!value->IsFunction()) 201 if (!value->IsFunction())
189 return; 202 return;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 v8::Handle<v8::Value> newValue = args[3]; 372 v8::Handle<v8::Value> newValue = args[3];
360 373
361 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); 374 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
362 ScriptDebugServer& debugServer = host->scriptDebugServer(); 375 ScriptDebugServer& debugServer = host->scriptDebugServer();
363 v8SetReturnValue(args, debugServer.setFunctionVariableValue(functionValue, s copeIndex, variableName, newValue)); 376 v8SetReturnValue(args, debugServer.setFunctionVariableValue(functionValue, s copeIndex, variableName, newValue));
364 } 377 }
365 378
366 379
367 } // namespace WebCore 380 } // namespace WebCore
368 381
OLDNEW
« Source/bindings/v8/V8Binding.cpp ('K') | « Source/bindings/v8/V8Binding.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698