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

Side by Side Diff: sky/engine/core/inspector/InjectedScriptBase.h

Issue 727593004: Wire up the Inspector V8 Debugger (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Actually works Created 6 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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
11 * copyright notice, this list of conditions and the following disclaimer 11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the 12 * in the documentation and/or other materials provided with the
13 * distribution. 13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its 14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from 15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission. 16 * this software without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef ScriptArguments_h 31 #ifndef InjectedScriptBase_h
32 #define ScriptArguments_h 32 #define InjectedScriptBase_h
33 33
34 #include "bindings/core/v8/ScriptState.h" 34 #include "bindings/core/v8/ScriptState.h"
35 #include "bindings/core/v8/ScriptValue.h"
36 #include "core/InspectorTypeBuilder.h"
35 #include "wtf/Forward.h" 37 #include "wtf/Forward.h"
36 #include "wtf/RefCounted.h"
37 #include "wtf/Vector.h"
38 #include "wtf/text/WTFString.h"
39 38
40 namespace blink { 39 namespace blink {
41 40
42 class ScriptValue; 41 class JSONValue;
42 class ScriptFunctionCall;
43 43
44 class ScriptArguments : public RefCounted<ScriptArguments> { 44 typedef String ErrorString;
45 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ScriptArguments); 45
46
47 class InjectedScriptBase {
46 public: 48 public:
47 static PassRefPtr<ScriptArguments> create(ScriptState*, Vector<ScriptValue>& arguments); 49 virtual ~InjectedScriptBase() { }
48 50
49 const ScriptValue& argumentAt(size_t) const; 51 const String& name() const { return m_name; }
50 size_t argumentCount() const { return m_arguments.size(); } 52 bool isEmpty() const { return m_injectedScriptObject.isEmpty(); }
53 ScriptState* scriptState() const
54 {
55 ASSERT(!isEmpty());
56 return m_injectedScriptObject.scriptState();
57 }
51 58
52 ScriptState* scriptState() const { return m_scriptState.get(); } 59 protected:
60 explicit InjectedScriptBase(const String& name);
61 InjectedScriptBase(const String& name, ScriptValue);
53 62
54 bool getFirstArgumentAsString(WTF::String& result, bool checkForNullOrUndefi ned = false); 63 void initialize(ScriptValue);
64 const ScriptValue& injectedScriptObject() const;
65 ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadExcept ion) const;
66 void makeCall(ScriptFunctionCall&, RefPtr<JSONValue>* result);
67 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<TypeBuilder::Run time::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown, RefPtr<Typ eBuilder::Debugger::ExceptionDetails>* = 0);
55 68
56 private: 69 private:
57 ScriptArguments(ScriptState*, Vector<ScriptValue>& arguments); 70 String m_name;
71 ScriptValue m_injectedScriptObject;
72 };
58 73
59 ScriptStateProtectingContext m_scriptState;
60 Vector<ScriptValue> m_arguments;
61 };
62 74
63 } // namespace blink 75 } // namespace blink
64 76
65 #endif // ScriptArguments_h 77 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698