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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 InjectedScript* injectedScriptFor(v8::Local<v8::Context>); | 57 InjectedScript* injectedScriptFor(v8::Local<v8::Context>); |
58 InjectedScript* findInjectedScript(int) const; | 58 InjectedScript* findInjectedScript(int) const; |
59 InjectedScript* findInjectedScript(ErrorString*, RemoteObjectIdBase*) const; | 59 InjectedScript* findInjectedScript(ErrorString*, RemoteObjectIdBase*) const; |
60 void discardInjectedScripts(); | 60 void discardInjectedScripts(); |
61 int discardInjectedScriptFor(v8::Local<v8::Context>); | 61 int discardInjectedScriptFor(v8::Local<v8::Context>); |
62 void discardInjectedScript(int); | 62 void discardInjectedScript(int); |
63 void releaseObjectGroup(const String16& objectGroup); | 63 void releaseObjectGroup(const String16& objectGroup); |
64 void setCustomObjectFormatterEnabled(bool); | 64 void setCustomObjectFormatterEnabled(bool); |
65 | 65 |
| 66 class ScopedGlobalObjectExtension { |
| 67 PROTOCOL_DISALLOW_COPY(ScopedGlobalObjectExtension); |
| 68 public: |
| 69 // Pass InjectedScriptManager to affect all contexts which have access. |
| 70 ScopedGlobalObjectExtension(InjectedScript* current, InjectedScriptManag
er*, v8::MaybeLocal<v8::Object> extension); |
| 71 ~ScopedGlobalObjectExtension(); |
| 72 |
| 73 private: |
| 74 void setOnGlobal(v8::Local<v8::Object> global, v8::Local<v8::Object> ext
ension); |
| 75 |
| 76 v8::Local<v8::Symbol> m_symbol; |
| 77 v8::Local<v8::Context> m_context; |
| 78 Vector<v8::Local<v8::Value>> m_globals; |
| 79 }; |
66 private: | 80 private: |
67 explicit InjectedScriptManager(V8DebuggerImpl*); | 81 explicit InjectedScriptManager(V8DebuggerImpl*); |
68 | 82 |
69 v8::Local<v8::Object> createInjectedScript(const String16& source, v8::Local
<v8::Context>, int id, InjectedScriptNative*); | 83 v8::Local<v8::Object> createInjectedScript(const String16& source, v8::Local
<v8::Context>, int id, InjectedScriptNative*); |
70 | 84 |
71 typedef protocol::HashMap<int, OwnPtr<InjectedScript>> IdToInjectedScriptMap
; | 85 typedef protocol::HashMap<int, OwnPtr<InjectedScript>> IdToInjectedScriptMap
; |
72 IdToInjectedScriptMap m_idToInjectedScript; | 86 IdToInjectedScriptMap m_idToInjectedScript; |
73 OwnPtr<InjectedScriptHost> m_injectedScriptHost; | 87 OwnPtr<InjectedScriptHost> m_injectedScriptHost; |
74 bool m_customObjectFormatterEnabled; | 88 bool m_customObjectFormatterEnabled; |
75 V8DebuggerImpl* m_debugger; | 89 V8DebuggerImpl* m_debugger; |
76 }; | 90 }; |
77 | 91 |
78 } // namespace blink | 92 } // namespace blink |
79 | 93 |
80 #endif // !defined(InjectedScriptManager_h) | 94 #endif // !defined(InjectedScriptManager_h) |
OLD | NEW |