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

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

Issue 23450039: Pass isolate to ScriptValue constructor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 Node* InjectedScriptHost::scriptValueAsNode(ScriptValue value) 64 Node* InjectedScriptHost::scriptValueAsNode(ScriptValue value)
65 { 65 {
66 v8::HandleScope scope(v8::Isolate::GetCurrent()); 66 v8::HandleScope scope(v8::Isolate::GetCurrent());
67 if (!value.isObject() || value.isNull()) 67 if (!value.isObject() || value.isNull())
68 return 0; 68 return 0;
69 return V8Node::toNative(v8::Handle<v8::Object>::Cast(value.v8Value())); 69 return V8Node::toNative(v8::Handle<v8::Object>::Cast(value.v8Value()));
70 } 70 }
71 71
72 ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* state, Node* node ) 72 ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* state, Node* node )
73 { 73 {
74 v8::HandleScope scope(state->isolate()); 74 v8::Isolate* isolate = state->isolate();
75 v8::HandleScope scope(isolate);
75 v8::Local<v8::Context> context = state->context(); 76 v8::Local<v8::Context> context = state->context();
76 v8::Context::Scope contextScope(context); 77 v8::Context::Scope contextScope(context);
77 78
78 if (!BindingSecurity::shouldAllowAccessToNode(node)) 79 if (!BindingSecurity::shouldAllowAccessToNode(node))
79 return ScriptValue(v8::Null(state->isolate())); 80 return ScriptValue(v8::Null(isolate), isolate);
80 return ScriptValue(toV8(node, v8::Handle<v8::Object>(), state->isolate())); 81 return ScriptValue(toV8(node, v8::Handle<v8::Object>(), isolate), isolate);
81 } 82 }
82 83
83 void V8InjectedScriptHost::inspectedObjectMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& args) 84 void V8InjectedScriptHost::inspectedObjectMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& args)
84 { 85 {
85 if (args.Length() < 1) 86 if (args.Length() < 1)
86 return; 87 return;
87 88
88 if (!args[0]->IsInt32()) { 89 if (!args[0]->IsInt32()) {
89 throwTypeError("argument has to be an integer", args.GetIsolate()); 90 throwTypeError("argument has to be an integer", args.GetIsolate());
90 return; 91 return;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 289
289 v8SetReturnValue(args, result); 290 v8SetReturnValue(args, result);
290 } 291 }
291 292
292 void V8InjectedScriptHost::inspectMethodCustom(const v8::FunctionCallbackInfo<v8 ::Value>& args) 293 void V8InjectedScriptHost::inspectMethodCustom(const v8::FunctionCallbackInfo<v8 ::Value>& args)
293 { 294 {
294 if (args.Length() < 2) 295 if (args.Length() < 2)
295 return; 296 return;
296 297
297 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); 298 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
298 ScriptValue object(args[0]); 299 ScriptValue object(args[0], args.GetIsolate());
299 ScriptValue hints(args[1]); 300 ScriptValue hints(args[1], args.GetIsolate());
300 host->inspectImpl(object.toJSONValue(ScriptState::current()), hints.toJSONVa lue(ScriptState::current())); 301 host->inspectImpl(object.toJSONValue(ScriptState::current()), hints.toJSONVa lue(ScriptState::current()));
301 } 302 }
302 303
303 void V8InjectedScriptHost::databaseIdMethodCustom(const v8::FunctionCallbackInfo <v8::Value>& args) 304 void V8InjectedScriptHost::databaseIdMethodCustom(const v8::FunctionCallbackInfo <v8::Value>& args)
304 { 305 {
305 if (args.Length() > 0 && V8Database::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))) { 306 if (args.Length() > 0 && V8Database::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))) {
306 Database* database = V8Database::toNative(v8::Handle<v8::Object>::Cast(a rgs[0])); 307 Database* database = V8Database::toNative(v8::Handle<v8::Object>::Cast(a rgs[0]));
307 if (database) { 308 if (database) {
308 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holde r()); { 309 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holde r()); {
309 v8SetReturnValueStringOrUndefined(args, host->databaseIdImpl(dat abase), args.GetIsolate()); 310 v8SetReturnValueStringOrUndefined(args, host->databaseIdImpl(dat abase), args.GetIsolate());
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 int lineNumber; 428 int lineNumber;
428 int columnNumber; 429 int columnNumber;
429 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) 430 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber))
430 return; 431 return;
431 432
432 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); 433 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
433 host->unmonitorFunction(scriptId, lineNumber, columnNumber); 434 host->unmonitorFunction(scriptId, lineNumber, columnNumber);
434 } 435 }
435 436
436 } // namespace WebCore 437 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/WorkerScriptController.cpp ('k') | Source/core/css/MediaQueryListListener.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698