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

Unified Diff: Source/bindings/dart/DartHandleProxy.cpp

Issue 23710032: Switch the DevTools to support a true Dart REPL (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: PTAL 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/dart/DartHandleProxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/dart/DartHandleProxy.cpp
diff --git a/Source/bindings/dart/DartHandleProxy.cpp b/Source/bindings/dart/DartHandleProxy.cpp
index c255c5bac61e8b1d235e93774ab7185608346e55..7fc936408074d19d0e3968e97e52ca85bf619e23 100644
--- a/Source/bindings/dart/DartHandleProxy.cpp
+++ b/Source/bindings/dart/DartHandleProxy.cpp
@@ -32,7 +32,6 @@
#include "DartNode.h"
#include "bindings/dart/DartScriptValue.h"
-#include "bindings/dart/DartUtilities.h"
#include "bindings/dart/V8Converter.h"
#include "bindings/v8/PageScriptDebugServer.h"
#include "bindings/v8/ScriptController.h"
@@ -43,8 +42,6 @@
#include "wtf/StdLibExtras.h"
-#include <dart_debugger_api.h>
-
namespace WebCore {
typedef HashMap<String, v8::Persistent<v8::FunctionTemplate>* > FunctionTemplateMap;
@@ -61,38 +58,24 @@ DartScriptValue* readPointerFromProxy(v8::Handle<v8::Value> proxy)
return static_cast<DartScriptValue*>(pointer);
}
-/**
- * Helper class to manage all scopes that must be entered to safely invoke Dart
- * code.
- */
-class DartScopes {
-private:
- DartScriptValue* scriptValue;
- DartIsolateScope scope;
- DartApiScope apiScope;
- Dart_ExceptionPauseInfo previousPauseInfo;
-
-public:
- Dart_Handle handle;
-
- DartScopes(v8::Local<v8::Object> v8Handle) :
- scriptValue(readPointerFromProxy(v8Handle)),
- scope(scriptValue->isolate())
- {
- ASSERT(scriptValue->isIsolateAlive());
- handle = Dart_HandleFromPersistent(scriptValue->value());
- previousPauseInfo = Dart_GetExceptionPauseInfo();
- // FIXME: it is not clear this is the right long term solution but for
- // now we prevent pausing on exceptions when executing Dart code to
- // avoid crashing when handling an exception triggers an exception.
- Dart_SetExceptionPauseInfo(kNoPauseOnExceptions);
- }
+DartScopes::DartScopes(v8::Local<v8::Object> v8Handle) :
+ scriptValue(readPointerFromProxy(v8Handle)),
+ scope(scriptValue->isolate())
+{
+ ASSERT(scriptValue->isIsolateAlive());
+ handle = Dart_HandleFromPersistent(scriptValue->value());
+ previousPauseInfo = Dart_GetExceptionPauseInfo();
+ // FIXME: it is not clear this is the right long term solution but for
+ // now we prevent pausing on exceptions when executing Dart code to
+ // avoid crashing when handling an exception triggers an exception.
+ Dart_SetExceptionPauseInfo(kNoPauseOnExceptions);
+}
+
+DartScopes::~DartScopes()
+{
+ Dart_SetExceptionPauseInfo(previousPauseInfo);
+}
- ~DartScopes()
- {
- Dart_SetExceptionPauseInfo(previousPauseInfo);
- }
-};
static void weakCallback(v8::Isolate* isolate, v8::Persistent<v8::Object>* proxy, DartScriptValue* value)
{
@@ -100,7 +83,7 @@ static void weakCallback(v8::Isolate* isolate, v8::Persistent<v8::Object>* proxy
proxy->Dispose(isolate);
}
-static Dart_Handle unwrapValue(v8::Handle<v8::Value> value)
+Dart_Handle DartHandleProxy::unwrapValue(v8::Handle<v8::Value> value)
{
if (DartHandleProxy::isDartProxy(value))
return Dart_HandleFromPersistent(readPointerFromProxy(value)->value());
@@ -347,7 +330,7 @@ static void functionInvocationCallback(const v8::FunctionCallbackInfo<v8::Value>
Vector<Dart_Handle> dartFunctionArgs;
for (uint32_t i = 0; i < args.Length(); ++i)
- dartFunctionArgs.append(unwrapValue(args[i]));
+ dartFunctionArgs.append(DartHandleProxy::unwrapValue(args[i]));
if (Dart_IsClosure(handle)) {
setReturnValue(args, Dart_InvokeClosure(handle, dartFunctionArgs.size(), dartFunctionArgs.data()));
@@ -392,7 +375,7 @@ static void typeProxyConstructorInvocationCallback(const v8::FunctionCallbackInf
Vector<Dart_Handle> dartFunctionArgs;
for (uint32_t i = 0; i < args.Length(); ++i)
- dartFunctionArgs.append(unwrapValue(args[i]));
+ dartFunctionArgs.append(DartHandleProxy::unwrapValue(args[i]));
setReturnValue(args, Dart_New(handle, Dart_Null(), dartFunctionArgs.size(), dartFunctionArgs.data()));
}
@@ -514,7 +497,7 @@ static void libraryNamedPropertySetter(v8::Local<v8::String> property, v8::Local
Dart_Handle ret;
ASSERT(Dart_IsLibrary(handle));
- Dart_Handle dartValue = unwrapValue(value);
+ Dart_Handle dartValue = DartHandleProxy::unwrapValue(value);
setReturnValue(info, Dart_SetField(handle, V8Converter::stringToDart(property), dartValue));
}
@@ -635,7 +618,7 @@ static void typeNamedPropertySetter(v8::Local<v8::String> property, v8::Local<v8
Dart_Handle handle = scopes.handle;
ASSERT(Dart_IsType(handle));
- Dart_Handle dartValue = unwrapValue(value);
+ Dart_Handle dartValue = DartHandleProxy::unwrapValue(value);
setReturnValue(info, Dart_Invoke(handle, V8Converter::stringToDart(v8::String::Concat(v8::String::New("set:"), property)), 1, &dartValue));
}
@@ -755,7 +738,7 @@ static void namedPropertySetter(v8::Local<v8::String> property, v8::Local<v8::Va
DartScopes scopes(info.Holder());
Dart_Handle handle = scopes.handle;
- Dart_Handle dartValue = unwrapValue(value);
+ Dart_Handle dartValue = DartHandleProxy::unwrapValue(value);
setReturnValue(info, Dart_Invoke(handle, V8Converter::stringToDart(v8::String::Concat(v8::String::New("set:"), property)), 1, &dartValue));
}
@@ -851,7 +834,7 @@ static void indexedSetter(uint32_t index, v8::Local<v8::Value> value, const v8::
Dart_Handle ret = 0;
if (Dart_IsList(handle))
- ret = Dart_ListSetAt(handle, index, unwrapValue(value));
+ ret = Dart_ListSetAt(handle, index, DartHandleProxy::unwrapValue(value));
else
ret = Dart_Null();
« no previous file with comments | « Source/bindings/dart/DartHandleProxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698