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

Unified Diff: Source/bindings/dart/DartInjectedScript.h

Issue 300393002: Merge DevTools Refactor CL to Blink36 (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1985
Patch Set: PTAL Created 6 years, 6 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/DartDebugServer.cpp ('k') | Source/bindings/dart/DartInjectedScript.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/dart/DartInjectedScript.h
diff --git a/Source/bindings/dart/DartInjectedScript.h b/Source/bindings/dart/DartInjectedScript.h
new file mode 100644
index 0000000000000000000000000000000000000000..54e3709955f61ea38098b9666cd1a12f1ade66a4
--- /dev/null
+++ b/Source/bindings/dart/DartInjectedScript.h
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 2014 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DartInjectedScript_h
+#define DartInjectedScript_h
+
+#include "InspectorTypeBuilder.h"
+#include "bindings/v8/ScriptObject.h"
+#include "core/inspector/InjectedScript.h"
+#include "core/inspector/InjectedScriptBase.h"
+#include "core/inspector/InjectedScriptManager.h"
+#include "core/inspector/ScriptArguments.h"
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+
+namespace WebCore {
+
+class DartScriptState;
+
+class DartDebuggerObject {
+ WTF_MAKE_NONCOPYABLE(DartDebuggerObject);
+public:
+ // FIXME: consider merging ObjectClass and Class, and Object if possible.
+ enum Kind {
+ Object,
+ ObjectClass,
+ Function,
+ Method,
+ Class,
+ StaticClass,
+ Library,
+ CurrentLibrary,
+ Isolate,
+ LocalVariables,
+ Error
+ };
+
+ DartDebuggerObject(Dart_PersistentHandle, const String& objectGroup, Kind);
+ ~DartDebuggerObject();
+ const String& group() const { return m_group; }
+ Dart_PersistentHandle persistentHandle() const { return m_handle; }
+ Dart_Handle handle() const { return m_handle; }
+ Kind kind() const { return m_kind; }
+
+private:
+ Dart_PersistentHandle m_handle;
+ String m_group;
+ Kind m_kind;
+};
+
+class DartInjectedScript : public InjectedScript {
+public:
+ DartInjectedScript();
+ virtual ~DartInjectedScript();
+
+ virtual bool isJavaScript() const { return false; }
+ virtual const String& name() const { return m_name; }
+
+ virtual void evaluate(ErrorString*,
+ const String& expression,
+ const String& objectGroup,
+ bool includeCommandLineAPI,
+ bool returnByValue,
+ bool generatePreview,
+ RefPtr<TypeBuilder::Runtime::RemoteObject>* result,
+ TypeBuilder::OptOutput<bool>* wasThrown);
+ virtual void callFunctionOn(ErrorString*,
+ const String& objectId,
+ const String& expression,
+ const String& arguments,
+ bool returnByValue,
+ bool generatePreview,
+ RefPtr<TypeBuilder::Runtime::RemoteObject>* result,
+ TypeBuilder::OptOutput<bool>* wasThrown);
+ virtual void evaluateOnCallFrame(ErrorString*,
+ const StackTrace& callFrames,
+ const Vector<StackTrace>& asyncCallStacks,
+ const String& callFrameId,
+ const String& expression,
+ const String& objectGroup,
+ bool includeCommandLineAPI,
+ bool returnByValue,
+ bool generatePreview,
+ RefPtr<TypeBuilder::Runtime::RemoteObject>* result,
+ TypeBuilder::OptOutput<bool>* wasThrown);
+ virtual void getCompletionsOnCallFrame(
+ ErrorString*,
+ const StackTrace& callFrames,
+ const Vector<StackTrace>& asyncCallStacks,
+ const String& callFrameId,
+ const String& expression,
+ RefPtr<TypeBuilder::Array<String> >* result);
+ virtual void restartFrame(ErrorString*, const StackTrace& callFrames, const String& callFrameId, RefPtr<JSONObject>* result);
+ virtual void getStepInPositions(ErrorString*, const StackTrace& callFrames, const String& callFrameId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Location> >& positions);
+ virtual void setVariableValue(ErrorString*, const StackTrace& callFrames, const String* callFrameIdOpt, const String* functionObjectIdOpt, int scopeNumber, const String& variableName, const String& newValueStr);
+ virtual void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<TypeBuilder::Debugger::FunctionDetails>* result);
+ virtual void getCompletions(ErrorString*, const String& expression, RefPtr<TypeBuilder::Array<String> >* out_result);
+ virtual void getProperties(ErrorString*, const String& objectId, bool ownProperties, bool accessorPropertiesOnly, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::PropertyDescriptor> >* result);
+ virtual void getInternalProperties(ErrorString*, const String& objectId, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::InternalPropertyDescriptor> >* result);
+ virtual void getProperty(ErrorString*, const String& objectId, const RefPtr<JSONArray>& propertyPath, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
+
+ virtual Node* nodeForObjectId(const String& objectId);
+ virtual void releaseObject(const String& objectId);
+
+ virtual PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> > wrapCallFrames(const StackTrace&, int asyncOrdinal);
+
+ virtual PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapObject(const ScriptValue&, const String& groupName, bool generatePreview = false);
+ virtual PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapTable(const ScriptValue& table, const ScriptValue& columns);
+ virtual ActivationFrame findCallFrameById(ErrorString*, const StackTrace& topCallFrame, const String& callFrameId);
+
+ virtual void releaseObjectGroup(const String&);
+
+ virtual bool isEmpty() const { return !m_scriptState; }
+
+ virtual ScriptState* scriptState() const;
+
+ PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapDartObject(Dart_Handle, const String& groupName, bool generatePreview = false);
+
+ bool canAccessInspectedWindow() const;
+
+private:
+ Dart_Handle library();
+
+ friend class InjectedScriptModule;
+ friend InjectedScript& InjectedScriptManager::injectedScriptFor(ScriptState*);
+ DartInjectedScript(DartScriptState*, InspectedStateAccessCheck, int injectedScriptId, InjectedScriptHost*);
+
+ bool validateObjectId(const String& objectId);
+
+ PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapDartHandle(Dart_Handle, DartDebuggerObject::Kind, const String& groupName, bool generatePreview);
+
+ DartDebuggerObject::Kind inferKind(Dart_Handle);
+
+ String cacheObject(Dart_Handle, const String& objectGroup, DartDebuggerObject::Kind);
+ DartDebuggerObject* lookupObject(const String& objectId);
+
+ void evaluateAndPackageResult(Dart_Handle target, const String& rawExpression, Dart_Handle localVariables, bool includeCommandLineAPI, const String& objectGroup, ErrorString*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
+ Dart_Handle evaluateHelper(Dart_Handle target, const String& rawExpression, Dart_Handle localVariables, bool includeCommandLineAPI, Dart_Handle& exception);
+
+ void packageResult(Dart_Handle, DartDebuggerObject::Kind, const String& objectGroup, ErrorString*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
+ void packageObjectResult(Dart_Handle, const String& objectGroup, ErrorString*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
+ void packageObjectClassResult(Dart_Handle, const String& objectGroup, ErrorString*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
+ void packageLibraryResult(Dart_Handle, DartDebuggerObject::Kind, const String& objectGroup, ErrorString*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
+ void packageIsolateResult(Dart_Handle, const String& objectGroup, ErrorString*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
+ void packageClassResult(Dart_Handle, DartDebuggerObject::Kind, const String& objectGroup, ErrorString*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
+ void packageFunctionResult(Dart_Handle, const String& objectGroup, ErrorString*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
+ void packageMethodResult(Dart_Handle, const String& objectGroup, ErrorString*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
+ void packageLocalVariablesResult(Dart_Handle, const String& objectGroup, ErrorString*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
+ void packageErrorResult(Dart_Handle, const String& objectGroup, ErrorString*, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown);
+
+ String getCallFrameId(int ordinal, int asyncOrdinal);
+ Dart_ActivationFrame callFrameForId(const StackTrace& callFrames, const Vector<StackTrace>& asyncCallStacks, const String& callFrameId);
+
+ Dart_Handle consoleApi();
+
+ String m_name;
+ InspectedStateAccessCheck m_inspectedStateAccessCheck;
+
+ typedef HashMap<String, Vector<String> > ObjectGroupMap;
+ ObjectGroupMap m_objectGroups;
+
+ // FIXME: use RefPtr<DartDebuggerObject> instead of DartDebuggerObject*
+ typedef HashMap<String, DartDebuggerObject*> DebuggerObjectMap;
+ DebuggerObjectMap m_objects;
+
+ DartScriptState* m_scriptState;
+
+ size_t m_nextObjectId;
+ int m_injectedScriptId;
+ InjectedScriptHost* m_host;
+ Dart_PersistentHandle m_consoleApi;
+};
+
+} // namespace WebCore
+
+#endif
« no previous file with comments | « Source/bindings/dart/DartDebugServer.cpp ('k') | Source/bindings/dart/DartInjectedScript.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698