OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ |
6 #define CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 std::string GetContextTypeDescription(); | 109 std::string GetContextTypeDescription(); |
110 | 110 |
111 // RequestSender::Source implementation. | 111 // RequestSender::Source implementation. |
112 virtual ChromeV8Context* GetContext() OVERRIDE; | 112 virtual ChromeV8Context* GetContext() OVERRIDE; |
113 virtual void OnResponseReceived(const std::string& name, | 113 virtual void OnResponseReceived(const std::string& name, |
114 int request_id, | 114 int request_id, |
115 bool success, | 115 bool success, |
116 const base::ListValue& response, | 116 const base::ListValue& response, |
117 const std::string& error) OVERRIDE; | 117 const std::string& error) OVERRIDE; |
118 | 118 |
119 v8::Isolate* isolate() const { | |
120 return isolate_; | |
Jeffrey Yasskin
2013/09/05 17:36:26
I believe you can get this from v8_context()->GetI
marja
2013/09/06 08:31:24
v8_context_ is a ScopedPersistent, and we shouldn'
Jeffrey Yasskin
2013/09/06 16:10:14
Oh, I see. Certainly a good answer for this CL. I
| |
121 } | |
122 | |
119 private: | 123 private: |
120 // The v8 context the bindings are accessible to. | 124 // The v8 context the bindings are accessible to. |
121 ScopedPersistent<v8::Context> v8_context_; | 125 ScopedPersistent<v8::Context> v8_context_; |
122 | 126 |
123 // The WebFrame associated with this context. This can be NULL because this | 127 // The WebFrame associated with this context. This can be NULL because this |
124 // object can outlive is destroyed asynchronously. | 128 // object can outlive is destroyed asynchronously. |
125 WebKit::WebFrame* web_frame_; | 129 WebKit::WebFrame* web_frame_; |
126 | 130 |
127 // The extension associated with this context, or NULL if there is none. This | 131 // The extension associated with this context, or NULL if there is none. This |
128 // might be a hosted app in the case that this context is hosting a web URL. | 132 // might be a hosted app in the case that this context is hosting a web URL. |
129 scoped_refptr<const Extension> extension_; | 133 scoped_refptr<const Extension> extension_; |
130 | 134 |
131 // The type of context. | 135 // The type of context. |
132 Feature::Context context_type_; | 136 Feature::Context context_type_; |
133 | 137 |
134 // Owns and structures the JS that is injected to set up extension bindings. | 138 // Owns and structures the JS that is injected to set up extension bindings. |
135 scoped_ptr<ModuleSystem> module_system_; | 139 scoped_ptr<ModuleSystem> module_system_; |
136 | 140 |
137 // Contains safe copies of builtin objects like Function.prototype. | 141 // Contains safe copies of builtin objects like Function.prototype. |
138 SafeBuiltins safe_builtins_; | 142 SafeBuiltins safe_builtins_; |
139 | 143 |
144 v8::Isolate* isolate_; | |
145 | |
140 DISALLOW_COPY_AND_ASSIGN(ChromeV8Context); | 146 DISALLOW_COPY_AND_ASSIGN(ChromeV8Context); |
141 }; | 147 }; |
142 | 148 |
143 } // namespace extensions | 149 } // namespace extensions |
144 | 150 |
145 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ | 151 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_H_ |
OLD | NEW |