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_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // Kicks off a process on the file thread to reload scripts from disk | 44 // Kicks off a process on the file thread to reload scripts from disk |
45 // into a new chunk of shared memory and notify renderers. | 45 // into a new chunk of shared memory and notify renderers. |
46 virtual void StartLoad(); | 46 virtual void StartLoad(); |
47 | 47 |
48 // Gets the segment of shared memory for the scripts. | 48 // Gets the segment of shared memory for the scripts. |
49 base::SharedMemory* GetSharedMemory() const { | 49 base::SharedMemory* GetSharedMemory() const { |
50 return shared_memory_.get(); | 50 return shared_memory_.get(); |
51 } | 51 } |
52 | 52 |
53 // Called by the script reloader when new scripts have been loaded. | 53 // Called by the script reloader when new scripts have been loaded. |
54 void NewScriptsAvailable(base::SharedMemory* handle); | 54 void NewScriptsAvailable(scoped_ptr<base::SharedMemory> handle); |
55 | 55 |
56 // Return true if we have any scripts ready. | 56 // Return true if we have any scripts ready. |
57 bool ScriptsReady() const { return shared_memory_.get() != NULL; } | 57 bool ScriptsReady() const { return shared_memory_.get() != NULL; } |
58 | 58 |
59 // Returns the content verifier for our browser context. | 59 // Returns the content verifier for our browser context. |
60 ContentVerifier* content_verifier(); | 60 ContentVerifier* content_verifier(); |
61 | 61 |
62 protected: | 62 protected: |
63 friend class base::RefCountedThreadSafe<UserScriptMaster>; | 63 friend class base::RefCountedThreadSafe<UserScriptMaster>; |
64 | 64 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 ~ScriptReloader(); | 98 ~ScriptReloader(); |
99 | 99 |
100 // Where functions are run: | 100 // Where functions are run: |
101 // master file | 101 // master file |
102 // StartLoad -> RunLoad | 102 // StartLoad -> RunLoad |
103 // LoadUserScripts() | 103 // LoadUserScripts() |
104 // NotifyMaster <- RunLoad | 104 // NotifyMaster <- RunLoad |
105 | 105 |
106 // Runs on the master thread. | 106 // Runs on the master thread. |
107 // Notify the master that new scripts are available. | 107 // Notify the master that new scripts are available. |
108 void NotifyMaster(base::SharedMemory* memory); | 108 void NotifyMaster(scoped_ptr<base::SharedMemory> memory); |
109 | 109 |
110 // Runs on the File thread. | 110 // Runs on the File thread. |
111 // Load the specified user scripts, calling NotifyMaster when done. | 111 // Load the specified user scripts, calling NotifyMaster when done. |
112 // |user_scripts| is intentionally passed by value so its lifetime isn't | 112 // |user_scripts| is intentionally passed by value so its lifetime isn't |
113 // tied to the caller. | 113 // tied to the caller. |
114 void RunLoad(const UserScriptList& user_scripts); | 114 void RunLoad(const UserScriptList& user_scripts); |
115 | 115 |
116 void LoadUserScripts(UserScriptList* user_scripts); | 116 void LoadUserScripts(UserScriptList* user_scripts); |
117 | 117 |
118 // Uses extensions_info_ to build a map of localization messages. | 118 // Uses extensions_info_ to build a map of localization messages. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // Listen to extension load, unloaded notifications. | 183 // Listen to extension load, unloaded notifications. |
184 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 184 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
185 extension_registry_observer_; | 185 extension_registry_observer_; |
186 | 186 |
187 DISALLOW_COPY_AND_ASSIGN(UserScriptMaster); | 187 DISALLOW_COPY_AND_ASSIGN(UserScriptMaster); |
188 }; | 188 }; |
189 | 189 |
190 } // namespace extensions | 190 } // namespace extensions |
191 | 191 |
192 #endif // CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ | 192 #endif // CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ |
OLD | NEW |