Chromium Code Reviews| 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_SET_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_SET_H_ |
| 6 #define CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_SET_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_SET_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "v8/include/v8.h" | 13 #include "v8/include/v8.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class ListValue; | 18 class ListValue; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 class RenderView; | 22 class RenderView; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace WebKit { | |
| 26 class WebFrame; | |
| 27 } | |
| 28 | |
| 25 namespace v8 { | 29 namespace v8 { |
| 26 class Context; | 30 class Context; |
| 27 } | 31 } |
| 28 | 32 |
| 29 namespace extensions { | 33 namespace extensions { |
| 30 class ChromeV8Context; | 34 class ChromeV8Context; |
| 31 | 35 |
| 32 // A container of ExtensionBindingsContext. Since calling JavaScript within a | 36 // A container of ExtensionBindingsContext. Since calling JavaScript within a |
| 33 // context can cause any number of contexts to be created or destroyed, this | 37 // context can cause any number of contexts to be created or destroyed, this |
| 34 // has additional smarts to help with the set changing underneath callers. | 38 // has additional smarts to help with the set changing underneath callers. |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 56 ChromeV8Context* GetCurrent() const; | 60 ChromeV8Context* GetCurrent() const; |
| 57 | 61 |
| 58 // Gets the ChromeV8Context corresponding to v8::Context::GetCalling(), or | 62 // Gets the ChromeV8Context corresponding to v8::Context::GetCalling(), or |
| 59 // NULL if no such context exists. | 63 // NULL if no such context exists. |
| 60 ChromeV8Context* GetCalling() const; | 64 ChromeV8Context* GetCalling() const; |
| 61 | 65 |
| 62 // Gets the ChromeV8Context corresponding to the specified | 66 // Gets the ChromeV8Context corresponding to the specified |
| 63 // v8::Context or NULL if no such context exists. | 67 // v8::Context or NULL if no such context exists. |
| 64 ChromeV8Context* GetByV8Context(v8::Handle<v8::Context> context) const; | 68 ChromeV8Context* GetByV8Context(v8::Handle<v8::Context> context) const; |
| 65 | 69 |
| 70 // Gets the ChromeV8Context corresponding to the given WebFrame. | |
| 71 ChromeV8Context* GetByWebFrame(WebKit::WebFrame* web_frame) const; | |
|
not at google - send to devlin
2013/08/23 01:19:13
Ok this method doesn't make any sense. There are m
| |
| 72 | |
| 66 // Synchronously runs |callback| with each ChromeV8Context that belongs to | 73 // Synchronously runs |callback| with each ChromeV8Context that belongs to |
| 67 // |extension_id| in |render_view|. | 74 // |extension_id| in |render_view|. |
| 68 // | 75 // |
| 69 // |extension_id| may be "" to match all extensions. | 76 // |extension_id| may be "" to match all extensions. |
| 70 // |render_view| may be NULL to match all render views. | 77 // |render_view| may be NULL to match all render views. |
| 71 void ForEach(const std::string& extension_id, | 78 void ForEach(const std::string& extension_id, |
| 72 content::RenderView* render_view, | 79 content::RenderView* render_view, |
| 73 const base::Callback<void(ChromeV8Context*)>& callback) const; | 80 const base::Callback<void(ChromeV8Context*)>& callback) const; |
| 74 | 81 |
| 75 // Cleans up contexts belonging to an unloaded extension. | 82 // Cleans up contexts belonging to an unloaded extension. |
| 76 // | 83 // |
| 77 // Returns the set of ChromeV8Contexts that were removed as a result. These | 84 // Returns the set of ChromeV8Contexts that were removed as a result. These |
| 78 // are safe to interact with until the end of the current event loop, since | 85 // are safe to interact with until the end of the current event loop, since |
| 79 // they're deleted asynchronously. | 86 // they're deleted asynchronously. |
| 80 ContextSet OnExtensionUnloaded(const std::string& extension_id); | 87 ContextSet OnExtensionUnloaded(const std::string& extension_id); |
| 81 | 88 |
| 82 private: | 89 private: |
| 83 ContextSet contexts_; | 90 ContextSet contexts_; |
| 84 | 91 |
| 85 DISALLOW_COPY_AND_ASSIGN(ChromeV8ContextSet); | 92 DISALLOW_COPY_AND_ASSIGN(ChromeV8ContextSet); |
| 86 }; | 93 }; |
| 87 | 94 |
| 88 } // namespace extensions | 95 } // namespace extensions |
| 89 | 96 |
| 90 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_SET_H_ | 97 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_CONTEXT_SET_H_ |
| OLD | NEW |