OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 12 matching lines...) Expand all Loading... |
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #ifndef InjectedScriptManager_h | 30 #ifndef InjectedScriptManager_h |
31 #define InjectedScriptManager_h | 31 #define InjectedScriptManager_h |
32 | 32 |
33 #include "bindings/core/v8/ScriptState.h" | |
34 #include "core/CoreExport.h" | 33 #include "core/CoreExport.h" |
35 #include "wtf/Forward.h" | 34 #include "wtf/Forward.h" |
36 #include "wtf/HashMap.h" | 35 #include "wtf/HashMap.h" |
37 #include "wtf/text/WTFString.h" | 36 #include "wtf/text/WTFString.h" |
38 #include <v8.h> | 37 #include <v8.h> |
39 | 38 |
40 namespace blink { | 39 namespace blink { |
41 | 40 |
42 class InjectedScript; | 41 class InjectedScript; |
43 class InjectedScriptHost; | 42 class InjectedScriptHost; |
44 class InjectedScriptNative; | 43 class InjectedScriptNative; |
45 class RemoteObjectIdBase; | 44 class RemoteObjectIdBase; |
46 class ScriptValue; | |
47 class V8DebuggerClient; | 45 class V8DebuggerClient; |
48 | 46 |
49 class CORE_EXPORT InjectedScriptManager { | 47 class CORE_EXPORT InjectedScriptManager { |
50 WTF_MAKE_NONCOPYABLE(InjectedScriptManager); | 48 WTF_MAKE_NONCOPYABLE(InjectedScriptManager); |
51 USING_FAST_MALLOC(InjectedScriptManager); | 49 USING_FAST_MALLOC(InjectedScriptManager); |
52 public: | 50 public: |
53 static PassOwnPtr<InjectedScriptManager> create(V8DebuggerClient*); | 51 static PassOwnPtr<InjectedScriptManager> create(V8DebuggerClient*); |
54 ~InjectedScriptManager(); | 52 ~InjectedScriptManager(); |
55 | 53 |
56 void disconnect(); | 54 void disconnect(); |
57 | 55 |
58 InjectedScriptHost* injectedScriptHost(); | 56 InjectedScriptHost* injectedScriptHost(); |
59 | 57 |
60 InjectedScript* injectedScriptFor(ScriptState*); | 58 InjectedScript* injectedScriptFor(v8::Local<v8::Context>); |
61 InjectedScript* findInjectedScript(int) const; | 59 InjectedScript* findInjectedScript(int) const; |
62 InjectedScript* findInjectedScript(RemoteObjectIdBase*) const; | 60 InjectedScript* findInjectedScript(RemoteObjectIdBase*) const; |
63 void discardInjectedScripts(); | 61 void discardInjectedScripts(); |
64 int discardInjectedScriptFor(ScriptState*); | 62 int discardInjectedScriptFor(v8::Local<v8::Context>); |
65 void releaseObjectGroup(const String& objectGroup); | 63 void releaseObjectGroup(const String& objectGroup); |
66 | |
67 typedef bool (*InspectedStateAccessCheck)(ScriptState*); | |
68 | |
69 void setCustomObjectFormatterEnabled(bool); | 64 void setCustomObjectFormatterEnabled(bool); |
70 | 65 |
71 private: | 66 private: |
72 explicit InjectedScriptManager(V8DebuggerClient*); | 67 explicit InjectedScriptManager(V8DebuggerClient*); |
73 | 68 |
74 String injectedScriptSource(); | 69 String injectedScriptSource(); |
75 ScriptValue createInjectedScript(const String& source, ScriptState*, int id,
InjectedScriptNative*); | 70 v8::Local<v8::Object> createInjectedScript(const String& source, v8::Local<v
8::Context>, int id, InjectedScriptNative*); |
76 | 71 |
77 typedef HashMap<int, OwnPtr<InjectedScript>> IdToInjectedScriptMap; | 72 typedef HashMap<int, OwnPtr<InjectedScript>> IdToInjectedScriptMap; |
78 IdToInjectedScriptMap m_idToInjectedScript; | 73 IdToInjectedScriptMap m_idToInjectedScript; |
79 RefPtr<InjectedScriptHost> m_injectedScriptHost; | 74 RefPtr<InjectedScriptHost> m_injectedScriptHost; |
80 bool m_customObjectFormatterEnabled; | 75 bool m_customObjectFormatterEnabled; |
81 V8DebuggerClient* m_client; | 76 V8DebuggerClient* m_client; |
82 }; | 77 }; |
83 | 78 |
84 } // namespace blink | 79 } // namespace blink |
85 | 80 |
86 #endif // !defined(InjectedScriptManager_h) | 81 #endif // !defined(InjectedScriptManager_h) |
OLD | NEW |