Index: sky/engine/core/inspector/InjectedScriptBase.h |
diff --git a/sky/engine/core/inspector/ScriptArguments.h b/sky/engine/core/inspector/InjectedScriptBase.h |
similarity index 57% |
copy from sky/engine/core/inspector/ScriptArguments.h |
copy to sky/engine/core/inspector/InjectedScriptBase.h |
index 7f70d9c6d6dbfac547723e4c1d944e286cabe3e0..22a755ba30aa489e29e22f0f498bf60f881d9970 100644 |
--- a/sky/engine/core/inspector/ScriptArguments.h |
+++ b/sky/engine/core/inspector/InjectedScriptBase.h |
@@ -1,5 +1,5 @@ |
/* |
- * Copyright (c) 2010 Google Inc. All rights reserved. |
+ * Copyright (C) 2012 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 |
@@ -28,38 +28,50 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef ScriptArguments_h |
-#define ScriptArguments_h |
+#ifndef InjectedScriptBase_h |
+#define InjectedScriptBase_h |
#include "bindings/core/v8/ScriptState.h" |
+#include "bindings/core/v8/ScriptValue.h" |
+#include "core/InspectorTypeBuilder.h" |
#include "wtf/Forward.h" |
-#include "wtf/RefCounted.h" |
-#include "wtf/Vector.h" |
-#include "wtf/text/WTFString.h" |
namespace blink { |
-class ScriptValue; |
+class JSONValue; |
+class ScriptFunctionCall; |
-class ScriptArguments : public RefCounted<ScriptArguments> { |
- DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ScriptArguments); |
+typedef String ErrorString; |
+ |
+ |
+class InjectedScriptBase { |
public: |
- static PassRefPtr<ScriptArguments> create(ScriptState*, Vector<ScriptValue>& arguments); |
+ virtual ~InjectedScriptBase() { } |
- const ScriptValue& argumentAt(size_t) const; |
- size_t argumentCount() const { return m_arguments.size(); } |
+ const String& name() const { return m_name; } |
+ bool isEmpty() const { return m_injectedScriptObject.isEmpty(); } |
+ ScriptState* scriptState() const |
+ { |
+ ASSERT(!isEmpty()); |
+ return m_injectedScriptObject.scriptState(); |
+ } |
- ScriptState* scriptState() const { return m_scriptState.get(); } |
+protected: |
+ explicit InjectedScriptBase(const String& name); |
+ InjectedScriptBase(const String& name, ScriptValue); |
- bool getFirstArgumentAsString(WTF::String& result, bool checkForNullOrUndefined = false); |
+ void initialize(ScriptValue); |
+ const ScriptValue& injectedScriptObject() const; |
+ ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadException) const; |
+ void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result); |
+ void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown, RefPtr<TypeBuilder::Debugger::ExceptionDetails>* = 0); |
private: |
- ScriptArguments(ScriptState*, Vector<ScriptValue>& arguments); |
- |
- ScriptStateProtectingContext m_scriptState; |
- Vector<ScriptValue> m_arguments; |
+ String m_name; |
+ ScriptValue m_injectedScriptObject; |
}; |
+ |
} // namespace blink |
-#endif // ScriptArguments_h |
+#endif |