Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1398)

Side by Side Diff: chrome/renderer/extensions/extension_dispatcher.h

Issue 8574012: Schedule idle handler based on CPU usage. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_EXTENSION_DISPATCHER_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_
6 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ 6 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // If the extension is in fact idle, tell the browser process to close 83 // If the extension is in fact idle, tell the browser process to close
84 // the background page. 84 // the background page.
85 void CheckIdleStatus(const std::string& extension_id); 85 void CheckIdleStatus(const std::string& extension_id);
86 86
87 private: 87 private:
88 friend class RenderViewTest; 88 friend class RenderViewTest;
89 89
90 // RenderProcessObserver implementation: 90 // RenderProcessObserver implementation:
91 virtual bool OnControlMessageReceived(const IPC::Message& message); 91 virtual bool OnControlMessageReceived(const IPC::Message& message);
92 virtual void WebKitInitialized(); 92 virtual void WebKitInitialized();
93 virtual void IdleNotification();
94 93
95 void OnMessageInvoke(const std::string& extension_id, 94 void OnMessageInvoke(const std::string& extension_id,
96 const std::string& function_name, 95 const std::string& function_name,
97 const base::ListValue& args, 96 const base::ListValue& args,
98 const GURL& event_url); 97 const GURL& event_url);
99 void OnDeliverMessage(int target_port_id, const std::string& message); 98 void OnDeliverMessage(int target_port_id, const std::string& message);
100 void OnSetFunctionNames(const std::vector<std::string>& names); 99 void OnSetFunctionNames(const std::vector<std::string>& names);
101 void OnLoaded(const ExtensionMsg_Loaded_Params& params); 100 void OnLoaded(const ExtensionMsg_Loaded_Params& params);
102 void OnUnloaded(const std::string& id); 101 void OnUnloaded(const std::string& id);
103 void OnSetScriptingWhitelist( 102 void OnSetScriptingWhitelist(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // counterpart to ExtensionService in the browser. It contains information 136 // counterpart to ExtensionService in the browser. It contains information
138 // about all extensions currently loaded by the browser. 137 // about all extensions currently loaded by the browser.
139 ExtensionSet extensions_; 138 ExtensionSet extensions_;
140 139
141 // All the bindings contexts that are currently loaded for this renderer. 140 // All the bindings contexts that are currently loaded for this renderer.
142 // There is zero or one for each v8 context. 141 // There is zero or one for each v8 context.
143 ChromeV8ContextSet v8_context_set_; 142 ChromeV8ContextSet v8_context_set_;
144 143
145 scoped_ptr<UserScriptSlave> user_script_slave_; 144 scoped_ptr<UserScriptSlave> user_script_slave_;
146 145
147 // Same as above, but on a longer timer and will run even if the process is
148 // not idle, to ensure that IdleHandle gets called eventually.
149 base::RepeatingTimer<content::RenderThread> forced_idle_timer_;
150
151 // The v8 extensions which are restricted to extension-related contexts. 146 // The v8 extensions which are restricted to extension-related contexts.
152 std::set<std::string> restricted_v8_extensions_; 147 std::set<std::string> restricted_v8_extensions_;
153 148
154 // All declared function names from extension_api.json. 149 // All declared function names from extension_api.json.
155 std::set<std::string> function_names_; 150 std::set<std::string> function_names_;
156 151
157 // The extensions that are active in this process. 152 // The extensions that are active in this process.
158 std::set<std::string> active_extension_ids_; 153 std::set<std::string> active_extension_ids_;
159 154
160 // The applications that are active in this process. 155 // The applications that are active in this process.
161 std::set<std::string> active_application_ids_; 156 std::set<std::string> active_application_ids_;
162 157
163 // True once WebKit has been initialized (and it is therefore safe to poke). 158 // True once WebKit has been initialized (and it is therefore safe to poke).
164 bool is_webkit_initialized_; 159 bool is_webkit_initialized_;
165 160
166 std::string test_extension_id_; 161 std::string test_extension_id_;
167 162
168 // Status of webrequest usage for known extensions. 163 // Status of webrequest usage for known extensions.
169 // TODO(mpcomplete): remove. http://crbug.com/100411 164 // TODO(mpcomplete): remove. http://crbug.com/100411
170 bool webrequest_adblock_; 165 bool webrequest_adblock_;
171 bool webrequest_adblock_plus_; 166 bool webrequest_adblock_plus_;
172 bool webrequest_other_; 167 bool webrequest_other_;
173 168
174 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher); 169 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher);
175 }; 170 };
176 171
177 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ 172 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698