| Index: extensions/browser/api/api_resource_manager.h
|
| diff --git a/extensions/browser/api/api_resource_manager.h b/extensions/browser/api/api_resource_manager.h
|
| index c4f6c6abea7576f4fcec9759c3c9917d096cc44d..a90da12b5dbd57e11b5d05112f5a8bb3a8a218ed 100644
|
| --- a/extensions/browser/api/api_resource_manager.h
|
| +++ b/extensions/browser/api/api_resource_manager.h
|
| @@ -25,6 +25,8 @@
|
| namespace extensions {
|
|
|
| namespace api {
|
| +class BluetoothSocketApiFunction;
|
| +class BluetoothSocketEventDispatcher;
|
| class SerialEventDispatcher;
|
| }
|
|
|
| @@ -152,6 +154,9 @@ class ApiResourceManager : public BrowserContextKeyedAPI,
|
| private:
|
| // TODO(rockot): ApiResourceData could be moved out of ApiResourceManager and
|
| // we could avoid maintaining a friends list here.
|
| + friend class BluetoothAPI;
|
| + friend class api::BluetoothSocketApiFunction;
|
| + friend class api::BluetoothSocketEventDispatcher;
|
| friend class api::SerialEventDispatcher;
|
| friend class core_api::TCPServerSocketEventDispatcher;
|
| friend class core_api::TCPSocketEventDispatcher;
|
| @@ -215,26 +220,38 @@ class ApiResourceManager : public BrowserContextKeyedAPI,
|
| }
|
|
|
| void InitiateExtensionUnloadedCleanup(const std::string& extension_id) {
|
| - content::BrowserThread::PostTask(
|
| - thread_id_,
|
| - FROM_HERE,
|
| - base::Bind(&ApiResourceData::CleanupResourcesFromUnloadedExtension,
|
| - this,
|
| - extension_id));
|
| + if (content::BrowserThread::CurrentlyOn(thread_id_)) {
|
| + CleanupResourcesFromUnloadedExtension(extension_id);
|
| + } else {
|
| + content::BrowserThread::PostTask(
|
| + thread_id_,
|
| + FROM_HERE,
|
| + base::Bind(&ApiResourceData::CleanupResourcesFromUnloadedExtension,
|
| + this,
|
| + extension_id));
|
| + }
|
| }
|
|
|
| void InitiateExtensionSuspendedCleanup(const std::string& extension_id) {
|
| - content::BrowserThread::PostTask(
|
| - thread_id_,
|
| - FROM_HERE,
|
| - base::Bind(&ApiResourceData::CleanupResourcesFromSuspendedExtension,
|
| - this,
|
| - extension_id));
|
| + if (content::BrowserThread::CurrentlyOn(thread_id_)) {
|
| + CleanupResourcesFromSuspendedExtension(extension_id);
|
| + } else {
|
| + content::BrowserThread::PostTask(
|
| + thread_id_,
|
| + FROM_HERE,
|
| + base::Bind(&ApiResourceData::CleanupResourcesFromSuspendedExtension,
|
| + this,
|
| + extension_id));
|
| + }
|
| }
|
|
|
| void InititateCleanup() {
|
| - content::BrowserThread::PostTask(
|
| - thread_id_, FROM_HERE, base::Bind(&ApiResourceData::Cleanup, this));
|
| + if (content::BrowserThread::CurrentlyOn(thread_id_)) {
|
| + Cleanup();
|
| + } else {
|
| + content::BrowserThread::PostTask(
|
| + thread_id_, FROM_HERE, base::Bind(&ApiResourceData::Cleanup, this));
|
| + }
|
| }
|
|
|
| private:
|
|
|