OLD | NEW |
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_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <list> | 10 #include <list> |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 const NotificationDetails& details); | 271 const NotificationDetails& details); |
272 UIThreadExtensionFunction* function_; | 272 UIThreadExtensionFunction* function_; |
273 NotificationRegistrar registrar_; | 273 NotificationRegistrar registrar_; |
274 }; | 274 }; |
275 | 275 |
276 virtual void Destruct() const; | 276 virtual void Destruct() const; |
277 | 277 |
278 scoped_ptr<RenderViewHostTracker> tracker_; | 278 scoped_ptr<RenderViewHostTracker> tracker_; |
279 }; | 279 }; |
280 | 280 |
281 // Extension functions that run on the IO thread. | 281 // Extension functions that run on the IO thread. This type of function avoids |
| 282 // a roundtrip to and from the UI thread (because communication with the |
| 283 // extension process happens on the IO thread). It's intended to be used when |
| 284 // performance is critical (e.g. the webRequest API which can block network |
| 285 // requests). Generally, UIThreadExtensionFunction is more appropriate and will |
| 286 // be easier to use and interface with the rest of the browser. |
282 class IOThreadExtensionFunction : public ExtensionFunction { | 287 class IOThreadExtensionFunction : public ExtensionFunction { |
283 public: | 288 public: |
284 IOThreadExtensionFunction(); | 289 IOThreadExtensionFunction(); |
285 | 290 |
286 virtual IOThreadExtensionFunction* AsIOThreadExtensionFunction() OVERRIDE; | 291 virtual IOThreadExtensionFunction* AsIOThreadExtensionFunction() OVERRIDE; |
287 | 292 |
288 void set_ipc_sender(base::WeakPtr<ChromeRenderMessageFilter> ipc_sender, | 293 void set_ipc_sender(base::WeakPtr<ChromeRenderMessageFilter> ipc_sender, |
289 int routing_id) { | 294 int routing_id) { |
290 ipc_sender_ = ipc_sender; | 295 ipc_sender_ = ipc_sender; |
291 routing_id_ = routing_id; | 296 routing_id_ = routing_id; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 public: | 357 public: |
353 SyncIOThreadExtensionFunction(); | 358 SyncIOThreadExtensionFunction(); |
354 | 359 |
355 virtual void Run() OVERRIDE; | 360 virtual void Run() OVERRIDE; |
356 | 361 |
357 protected: | 362 protected: |
358 virtual ~SyncIOThreadExtensionFunction(); | 363 virtual ~SyncIOThreadExtensionFunction(); |
359 }; | 364 }; |
360 | 365 |
361 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 366 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
OLD | NEW |