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

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 10392181: Implement serial API for Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: From -> At. Created 8 years, 6 months 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) 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 #include "chrome/browser/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 ExtensionService::~ExtensionService() { 431 ExtensionService::~ExtensionService() {
432 // No need to unload extensions here because they are profile-scoped, and the 432 // No need to unload extensions here because they are profile-scoped, and the
433 // profile is in the process of being deleted. 433 // profile is in the process of being deleted.
434 434
435 ProviderCollection::const_iterator i; 435 ProviderCollection::const_iterator i;
436 for (i = external_extension_providers_.begin(); 436 for (i = external_extension_providers_.begin();
437 i != external_extension_providers_.end(); ++i) { 437 i != external_extension_providers_.end(); ++i) {
438 ExternalExtensionProviderInterface* provider = i->get(); 438 ExternalExtensionProviderInterface* provider = i->get();
439 provider->ServiceShutdown(); 439 provider->ServiceShutdown();
440 } 440 }
441
442 if (api_resource_controller_) {
443 // If this check failed, then a unit test was using an APIResource but
444 // didn't provide the IO thread message loop needed for those resources to
445 // do their job (including destroying themselves at shutdown).
446 DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::IO));
447 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE,
448 api_resource_controller_);
449 }
450 } 441 }
451 442
452 void ExtensionService::InitEventRoutersAfterImport() { 443 void ExtensionService::InitEventRoutersAfterImport() {
453 RegisterForImportFinished(); 444 RegisterForImportFinished();
454 } 445 }
455 446
456 void ExtensionService::RegisterForImportFinished() { 447 void ExtensionService::RegisterForImportFinished() {
457 if (!registrar_.IsRegistered(this, chrome::NOTIFICATION_IMPORT_FINISHED, 448 if (!registrar_.IsRegistered(this, chrome::NOTIFICATION_IMPORT_FINISHED,
458 content::Source<Profile>(profile_))) { 449 content::Source<Profile>(profile_))) {
459 registrar_.Add(this, chrome::NOTIFICATION_IMPORT_FINISHED, 450 registrar_.Add(this, chrome::NOTIFICATION_IMPORT_FINISHED,
(...skipping 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after
2544 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 2535 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
2545 iter != nacl_module_list_.end(); ++iter) { 2536 iter != nacl_module_list_.end(); ++iter) {
2546 if (iter->url == url) 2537 if (iter->url == url)
2547 return iter; 2538 return iter;
2548 } 2539 }
2549 return nacl_module_list_.end(); 2540 return nacl_module_list_.end();
2550 } 2541 }
2551 2542
2552 extensions::APIResourceController* 2543 extensions::APIResourceController*
2553 ExtensionService::api_resource_controller() { 2544 ExtensionService::api_resource_controller() {
2554 // TODO(miket): Find a better place for this thing to live. It needs to be 2545 // TODO(miket): Find a better place for this thing to live. Like every other
2555 // scoped such that it can be created and destroyed on the IO thread. 2546 // piece of baggage on ExtensionService, it's scoped along with a Profile.
2556 // 2547
2557 // To coexist with certain unit tests that don't have an IO thread message 2548 // To coexist with certain unit tests that don't have a work-thread message
2558 // loop available at ExtensionService shutdown, we lazy-initialize this 2549 // loop available at ExtensionService shutdown, we lazy-initialize this
2559 // object so that those cases neither create nor destroy an 2550 // object so that those cases neither create nor destroy an
2560 // APIResourceController. 2551 // APIResourceController.
2561 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 2552 if (!api_resource_controller_.get()) {
2562 if (!api_resource_controller_) { 2553 api_resource_controller_.reset(new extensions::APIResourceController());
2563 api_resource_controller_ = new extensions::APIResourceController();
2564 } 2554 }
2565 return api_resource_controller_; 2555 return api_resource_controller_.get();
2566 } 2556 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/common/extensions/api/experimental_serial.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698