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

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

Issue 24989007: Model each Dart library as its own ScriptState when devtools are enabled. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Ready for review Created 7 years, 2 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 19 matching lines...) Expand all
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "V8InjectedScriptHost.h" 32 #include "V8InjectedScriptHost.h"
33 33
34 #include "V8Database.h" 34 #include "V8Database.h"
35 #include "V8HTMLAllCollection.h" 35 #include "V8HTMLAllCollection.h"
36 #include "V8HTMLCollection.h" 36 #include "V8HTMLCollection.h"
37 #include "V8Node.h" 37 #include "V8Node.h"
38 #include "V8NodeList.h" 38 #include "V8NodeList.h"
39 #include "V8Storage.h" 39 #include "V8Storage.h"
40 #include "bindings/dart/DartController.h"
40 #include "bindings/dart/DartHandleProxy.h" 41 #include "bindings/dart/DartHandleProxy.h"
42 #include "bindings/dart/DartScriptState.h"
43 #include "bindings/dart/V8Converter.h"
41 #include "bindings/v8/BindingSecurity.h" 44 #include "bindings/v8/BindingSecurity.h"
42 #include "bindings/v8/ScriptDebugServer.h" 45 #include "bindings/v8/ScriptDebugServer.h"
43 #include "bindings/v8/ScriptValue.h" 46 #include "bindings/v8/ScriptValue.h"
44 #include "bindings/v8/V8AbstractEventListener.h" 47 #include "bindings/v8/V8AbstractEventListener.h"
45 #include "bindings/v8/V8Binding.h" 48 #include "bindings/v8/V8Binding.h"
46 #include "bindings/v8/V8HiddenPropertyName.h" 49 #include "bindings/v8/V8HiddenPropertyName.h"
50 #include "bindings/v8/V8RecursionScope.h"
47 #include "bindings/v8/V8ScriptRunner.h" 51 #include "bindings/v8/V8ScriptRunner.h"
48 #include "bindings/v8/custom/V8Float32ArrayCustom.h" 52 #include "bindings/v8/custom/V8Float32ArrayCustom.h"
49 #include "bindings/v8/custom/V8Float64ArrayCustom.h" 53 #include "bindings/v8/custom/V8Float64ArrayCustom.h"
50 #include "bindings/v8/custom/V8Int16ArrayCustom.h" 54 #include "bindings/v8/custom/V8Int16ArrayCustom.h"
51 #include "bindings/v8/custom/V8Int32ArrayCustom.h" 55 #include "bindings/v8/custom/V8Int32ArrayCustom.h"
52 #include "bindings/v8/custom/V8Int8ArrayCustom.h" 56 #include "bindings/v8/custom/V8Int8ArrayCustom.h"
53 #include "bindings/v8/custom/V8Uint16ArrayCustom.h" 57 #include "bindings/v8/custom/V8Uint16ArrayCustom.h"
54 #include "bindings/v8/custom/V8Uint32ArrayCustom.h" 58 #include "bindings/v8/custom/V8Uint32ArrayCustom.h"
55 #include "bindings/v8/custom/V8Uint8ArrayCustom.h" 59 #include "bindings/v8/custom/V8Uint8ArrayCustom.h"
56 #include "bindings/v8/custom/V8Uint8ClampedArrayCustom.h" 60 #include "bindings/v8/custom/V8Uint8ClampedArrayCustom.h"
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 return; 352 return;
349 } 353 }
350 354
351 v8::Handle<v8::String> expression = args[0]->ToString(); 355 v8::Handle<v8::String> expression = args[0]->ToString();
352 if (expression.IsEmpty()) { 356 if (expression.IsEmpty()) {
353 v8::ThrowException(v8::Exception::Error(v8::String::New("The argument mu st be a string."))); 357 v8::ThrowException(v8::Exception::Error(v8::String::New("The argument mu st be a string.")));
354 return; 358 return;
355 } 359 }
356 360
357 ASSERT(!v8::Context::GetCurrent().IsEmpty()); 361 ASSERT(!v8::Context::GetCurrent().IsEmpty());
362
vsm 2013/09/30 22:08:03 Can this code be refactored to be a call back into
Jacob 2013/10/01 00:07:05 Moved it to a new file called DartInjectedScriptHo
363 ScriptState* currentScriptState = 0;
364 v8::Local<v8::Value> scriptStateWrapper = args.Holder()->GetHiddenValue(V8Hi ddenPropertyName::scriptState());
365 if (!scriptStateWrapper.IsEmpty() && scriptStateWrapper->IsExternal())
366 currentScriptState = static_cast<ScriptState*>(v8::External::Cast(*scrip tStateWrapper)->Value());
367 else
368 currentScriptState = ScriptState::current();
369
370 ScriptExecutionContext* scriptExecutionContext = currentScriptState->scriptE xecutionContext();
371 ASSERT(scriptExecutionContext);
372
373 if (!currentScriptState->isJavaScript()) {
374 DartScriptState* dartScriptState = static_cast<DartScriptState*>(current ScriptState);
375 DartIsolateScope scope(dartScriptState->isolate());
376 DartApiScope apiScope;
377
378 Dart_Handle target = Dart_GetLibraryFromId(dartScriptState->libraryId()) ;
379 v8SetReturnValue(args, DartHandleProxy::evaluate(target, V8Converter::st ringToDart(expression), Dart_Null()));
380 return;
381 }
382
383 ASSERT(!v8::Context::GetCurrent().IsEmpty());
358 v8::TryCatch tryCatch; 384 v8::TryCatch tryCatch;
359 v8::Handle<v8::Value> result = V8ScriptRunner::compileAndRunInternalScript(e xpression, args.GetIsolate()); 385 v8::Handle<v8::Value> result = V8ScriptRunner::compileAndRunInternalScript(e xpression, args.GetIsolate());
360 if (tryCatch.HasCaught()) { 386 if (tryCatch.HasCaught()) {
361 v8SetReturnValue(args, tryCatch.ReThrow()); 387 v8SetReturnValue(args, tryCatch.ReThrow());
362 return; 388 return;
363 } 389 }
364 v8SetReturnValue(args, result); 390 v8SetReturnValue(args, result);
365 } 391 }
366 392
367 void V8InjectedScriptHost::setFunctionVariableValueMethodCustom(const v8::Functi onCallbackInfo<v8::Value>& args) 393 void V8InjectedScriptHost::setFunctionVariableValueMethodCustom(const v8::Functi onCallbackInfo<v8::Value>& args)
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 int lineNumber; 469 int lineNumber;
444 int columnNumber; 470 int columnNumber;
445 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber)) 471 if (!getFunctionLocation(args, &scriptId, &lineNumber, &columnNumber))
446 return; 472 return;
447 473
448 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder()); 474 InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
449 host->unmonitorFunction(scriptId, lineNumber, columnNumber); 475 host->unmonitorFunction(scriptId, lineNumber, columnNumber);
450 } 476 }
451 477
452 } // namespace WebCore 478 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698