OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ | 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ |
6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ | 6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 ~ScriptContextSet(); | 52 ~ScriptContextSet(); |
53 | 53 |
54 // Returns the number of contexts being tracked by this set. | 54 // Returns the number of contexts being tracked by this set. |
55 // This may also include invalid contexts. TODO(kalman): Useful? | 55 // This may also include invalid contexts. TODO(kalman): Useful? |
56 size_t size() const { return contexts_.size(); } | 56 size_t size() const { return contexts_.size(); } |
57 | 57 |
58 // Creates and starts managing a new ScriptContext. Ownership is held. | 58 // Creates and starts managing a new ScriptContext. Ownership is held. |
59 // Returns a weak reference to the new ScriptContext. | 59 // Returns a weak reference to the new ScriptContext. |
60 ScriptContext* Register(blink::WebLocalFrame* frame, | 60 ScriptContext* Register(blink::WebLocalFrame* frame, |
61 const v8::Local<v8::Context>& v8_context, | 61 const v8::Local<v8::Context>& v8_context, |
| 62 Feature::SessionType session_type, |
62 int extension_group, | 63 int extension_group, |
63 int world_id); | 64 int world_id); |
64 | 65 |
65 // If the specified context is contained in this set, remove it, then delete | 66 // If the specified context is contained in this set, remove it, then delete |
66 // it asynchronously. After this call returns the context object will still | 67 // it asynchronously. After this call returns the context object will still |
67 // be valid, but its frame() pointer will be cleared. | 68 // be valid, but its frame() pointer will be cleared. |
68 void Remove(ScriptContext* context); | 69 void Remove(ScriptContext* context); |
69 | 70 |
70 // Gets the ScriptContext corresponding to v8::Context::GetCurrent(), or | 71 // Gets the ScriptContext corresponding to v8::Context::GetCurrent(), or |
71 // NULL if no such context exists. | 72 // NULL if no such context exists. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 137 |
137 // The set of all ScriptContexts we own. | 138 // The set of all ScriptContexts we own. |
138 std::set<ScriptContext*> contexts_; | 139 std::set<ScriptContext*> contexts_; |
139 | 140 |
140 DISALLOW_COPY_AND_ASSIGN(ScriptContextSet); | 141 DISALLOW_COPY_AND_ASSIGN(ScriptContextSet); |
141 }; | 142 }; |
142 | 143 |
143 } // namespace extensions | 144 } // namespace extensions |
144 | 145 |
145 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ | 146 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ |
OLD | NEW |