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

Unified Diff: Source/bindings/dart/DartInjectedScriptHost.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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/dart/DartInjectedScriptHost.h ('k') | Source/bindings/dart/DartScriptState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/dart/DartInjectedScriptHost.cpp
diff --git a/Source/bindings/dart/custom/DartErrorEventCustom.cpp b/Source/bindings/dart/DartInjectedScriptHost.cpp
similarity index 51%
copy from Source/bindings/dart/custom/DartErrorEventCustom.cpp
copy to Source/bindings/dart/DartInjectedScriptHost.cpp
index 06a5c3a77c8e5d7e68d459ee9ac8f734cc3b4eba..a095836d6f2d9aab91683982628c871f29219e01 100644
--- a/Source/bindings/dart/custom/DartErrorEventCustom.cpp
+++ b/Source/bindings/dart/DartInjectedScriptHost.cpp
@@ -1,4 +1,4 @@
-// Copyright 2011, Google Inc.
+// Copyright 2013, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -28,37 +28,42 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "config.h"
-#include "DartErrorEvent.h"
+#include "DartInjectedScriptHost.h"
-#include "DartBlob.h"
-#include "DartWindow.h"
+#include "bindings/dart/DartController.h"
+#include "bindings/dart/DartHandleProxy.h"
+#include "bindings/dart/DartScriptState.h"
#include "bindings/dart/V8Converter.h"
-#include "bindings/v8/ScriptController.h"
+#include "bindings/v8/V8HiddenPropertyName.h"
namespace WebCore {
-namespace DartErrorEventInternal {
-
-void errorGetter(Dart_NativeArguments args)
+/**
+ * Returns true if the expression passed in my args was evaluated as Dart code.
+ */
+v8::Handle<v8::Value> DartInjectedScriptHost::evaluateIfDartContext(v8::Handle<v8::Object> v8InjectedScriptHost, v8::Handle<v8::String> expression)
{
- // Tricky to implement because V8 appears to implement by setting a V8HiddenValue
- /*
- {
- v8::Handle<v8::Value> error = info.Holder()->GetHiddenValue(V8HiddenPropertyName::error());
+ ASSERT(!v8::Context::GetCurrent().IsEmpty());
- if (!error.IsEmpty()) {
- v8SetReturnValue(info, error);
- return;
- }
- ErrorEvent* receiver = DartDOMWrapper::receiver< ErrorEvent >(args);
+ ScriptState* currentScriptState = 0;
+ v8::Local<v8::Value> scriptStateWrapper = v8InjectedScriptHost->GetHiddenValue(V8HiddenPropertyName::scriptState());
+ if (!scriptStateWrapper.IsEmpty() && scriptStateWrapper->IsExternal())
+ currentScriptState = static_cast<ScriptState*>(v8::External::Cast(*scriptStateWrapper)->Value());
+ else
+ currentScriptState = ScriptState::current();
- DartUtilities::setDartStringReturnValue(args, receiver->error());
- return;
- }
- */
- DART_UNIMPLEMENTED();
-}
+ ScriptExecutionContext* scriptExecutionContext = currentScriptState->scriptExecutionContext();
+ ASSERT(scriptExecutionContext);
-}
+ if (!currentScriptState->isJavaScript()) {
+ DartScriptState* dartScriptState = static_cast<DartScriptState*>(currentScriptState);
+ DartIsolateScope scope(dartScriptState->isolate());
+ DartApiScope apiScope;
+ Dart_Handle target = Dart_GetLibraryFromId(dartScriptState->libraryId());
+ return DartHandleProxy::evaluate(target, V8Converter::stringToDart(expression), Dart_Null());
+ }
+ return v8::Handle<v8::Value>();
}
+
+} // namespace WebCore
« no previous file with comments | « Source/bindings/dart/DartInjectedScriptHost.h ('k') | Source/bindings/dart/DartScriptState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698