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

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

Issue 14362015: WIP enum / V8PerContextData solution (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 8 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
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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 306
307 v8::Handle<v8::Value> V8InjectedScriptHost::evaluateMethodCustom(const v8::Argum ents& args) 307 v8::Handle<v8::Value> V8InjectedScriptHost::evaluateMethodCustom(const v8::Argum ents& args)
308 { 308 {
309 if (args.Length() < 1) 309 if (args.Length() < 1)
310 return v8::ThrowException(v8::Exception::Error(v8::String::New("One argu ment expected."))); 310 return v8::ThrowException(v8::Exception::Error(v8::String::New("One argu ment expected.")));
311 311
312 v8::Handle<v8::String> expression = args[0]->ToString(); 312 v8::Handle<v8::String> expression = args[0]->ToString();
313 if (expression.IsEmpty()) 313 if (expression.IsEmpty())
314 return v8::ThrowException(v8::Exception::Error(v8::String::New("The argu ment must be a string."))); 314 return v8::ThrowException(v8::Exception::Error(v8::String::New("The argu ment must be a string.")));
315 315
316 // Mark the context as temporarily used by debugger.
317 v8::HandleScope scope;
318 v8::Local<v8::Context> context = v8::Context::GetCurrent();
319 V8ScopedCompilation debuggerCompilation(context, DevtoolsScriptCompilation);
320
316 v8::Handle<v8::Script> script = v8::Script::Compile(expression); 321 v8::Handle<v8::Script> script = v8::Script::Compile(expression);
317 if (script.IsEmpty()) // Return immediately in case of exception to let the caller handle it. 322 if (script.IsEmpty()) // Return immediately in case of exception to let the caller handle it.
318 return v8::Handle<v8::Value>(); 323 return v8::Handle<v8::Value>();
319 return script->Run(); 324 return script->Run();
320 } 325 }
321 326
322 v8::Handle<v8::Value> V8InjectedScriptHost::setFunctionVariableValueMethodCustom (const v8::Arguments& args) 327 v8::Handle<v8::Value> V8InjectedScriptHost::setFunctionVariableValueMethodCustom (const v8::Arguments& args)
323 { 328 {
324 v8::Handle<v8::Value> functionValue = args[0]; 329 v8::Handle<v8::Value> functionValue = args[0];
325 int scopeIndex = args[1]->Int32Value(); 330 int scopeIndex = args[1]->Int32Value();
326 String variableName = toWebCoreStringWithUndefinedOrNullCheck(args[2]); 331 String variableName = toWebCoreStringWithUndefinedOrNullCheck(args[2]);
327 v8::Handle<v8::Value> newValue = args[3]; 332 v8::Handle<v8::Value> newValue = args[3];
328 333
329 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); 334 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
330 ScriptDebugServer& debugServer = host->scriptDebugServer(); 335 ScriptDebugServer& debugServer = host->scriptDebugServer();
331 return debugServer.setFunctionVariableValue(functionValue, scopeIndex, varia bleName, newValue); 336 return debugServer.setFunctionVariableValue(functionValue, scopeIndex, varia bleName, newValue);
332 } 337 }
333 338
334 339
335 } // namespace WebCore 340 } // namespace WebCore
336 341
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8PerContextDebugData.h ('k') | Source/bindings/v8/custom/V8InjectedScriptManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698