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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 10
(...skipping 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after
1962 } 1962 }
1963 1963
1964 void ExtensionService::GarbageCollectExtensions() { 1964 void ExtensionService::GarbageCollectExtensions() {
1965 if (extension_prefs_->pref_service()->ReadOnly()) 1965 if (extension_prefs_->pref_service()->ReadOnly())
1966 return; 1966 return;
1967 1967
1968 if (pending_extension_manager()->HasPendingExtensions()) { 1968 if (pending_extension_manager()->HasPendingExtensions()) {
1969 // Don't garbage collect while there are pending installations, which may 1969 // Don't garbage collect while there are pending installations, which may
1970 // be using the temporary installation directory. Try to garbage collect 1970 // be using the temporary installation directory. Try to garbage collect
1971 // again later. 1971 // again later.
1972 MessageLoop::current()->PostDelayedTask( 1972 base::MessageLoop::current()->PostDelayedTask(
1973 FROM_HERE, 1973 FROM_HERE,
1974 base::Bind(&ExtensionService::GarbageCollectExtensions, AsWeakPtr()), 1974 base::Bind(&ExtensionService::GarbageCollectExtensions, AsWeakPtr()),
1975 base::TimeDelta::FromSeconds(kGarbageCollectRetryDelay)); 1975 base::TimeDelta::FromSeconds(kGarbageCollectRetryDelay));
1976 return; 1976 return;
1977 } 1977 }
1978 1978
1979 scoped_ptr<extensions::ExtensionPrefs::ExtensionsInfo> info( 1979 scoped_ptr<extensions::ExtensionPrefs::ExtensionsInfo> info(
1980 extension_prefs_->GetInstalledExtensionsInfo()); 1980 extension_prefs_->GetInstalledExtensionsInfo());
1981 1981
1982 std::multimap<std::string, base::FilePath> extension_paths; 1982 std::multimap<std::string, base::FilePath> extension_paths;
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
2636 } 2636 }
2637 2637
2638 extensions::ExtensionHost* host = 2638 extensions::ExtensionHost* host =
2639 content::Details<extensions::ExtensionHost>(details).ptr(); 2639 content::Details<extensions::ExtensionHost>(details).ptr();
2640 2640
2641 // Mark the extension as terminated and Unload it. We want it to 2641 // Mark the extension as terminated and Unload it. We want it to
2642 // be in a consistent state: either fully working or not loaded 2642 // be in a consistent state: either fully working or not loaded
2643 // at all, but never half-crashed. We do it in a PostTask so 2643 // at all, but never half-crashed. We do it in a PostTask so
2644 // that other handlers of this notification will still have 2644 // that other handlers of this notification will still have
2645 // access to the Extension and ExtensionHost. 2645 // access to the Extension and ExtensionHost.
2646 MessageLoop::current()->PostTask( 2646 base::MessageLoop::current()->PostTask(
2647 FROM_HERE, 2647 FROM_HERE,
2648 base::Bind( 2648 base::Bind(
2649 &ExtensionService::TrackTerminatedExtension, 2649 &ExtensionService::TrackTerminatedExtension,
2650 AsWeakPtr(), 2650 AsWeakPtr(),
2651 host->extension())); 2651 host->extension()));
2652 break; 2652 break;
2653 } 2653 }
2654 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { 2654 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: {
2655 content::RenderProcessHost* process = 2655 content::RenderProcessHost* process =
2656 content::Source<content::RenderProcessHost>(source).ptr(); 2656 content::Source<content::RenderProcessHost>(source).ptr();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2704 InitAfterImport(); 2704 InitAfterImport();
2705 break; 2705 break;
2706 } 2706 }
2707 case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: { 2707 case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: {
2708 extensions::ExtensionHost* host = 2708 extensions::ExtensionHost* host =
2709 content::Details<extensions::ExtensionHost>(details).ptr(); 2709 content::Details<extensions::ExtensionHost>(details).ptr();
2710 std::string extension_id = host->extension_id(); 2710 std::string extension_id = host->extension_id();
2711 if (delayed_updates_for_idle_.Contains(extension_id)) { 2711 if (delayed_updates_for_idle_.Contains(extension_id)) {
2712 // We were waiting for this extension to become idle, it now might have, 2712 // We were waiting for this extension to become idle, it now might have,
2713 // so maybe finish installation. 2713 // so maybe finish installation.
2714 MessageLoop::current()->PostDelayedTask( 2714 base::MessageLoop::current()->PostDelayedTask(
2715 FROM_HERE, 2715 FROM_HERE,
2716 base::Bind(&ExtensionService::MaybeFinishDelayedInstallation, 2716 base::Bind(&ExtensionService::MaybeFinishDelayedInstallation,
2717 AsWeakPtr(), extension_id), 2717 AsWeakPtr(), extension_id),
2718 base::TimeDelta::FromSeconds(kUpdateIdleDelay)); 2718 base::TimeDelta::FromSeconds(kUpdateIdleDelay));
2719 } 2719 }
2720 break; 2720 break;
2721 } 2721 }
2722 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { 2722 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: {
2723 // Notify extensions that chrome update is available. 2723 // Notify extensions that chrome update is available.
2724 extensions::RuntimeEventRouter::DispatchOnBrowserUpdateAvailableEvent( 2724 extensions::RuntimeEventRouter::DispatchOnBrowserUpdateAvailableEvent(
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
3102 } 3102 }
3103 3103
3104 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { 3104 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) {
3105 update_observers_.AddObserver(observer); 3105 update_observers_.AddObserver(observer);
3106 } 3106 }
3107 3107
3108 void ExtensionService::RemoveUpdateObserver( 3108 void ExtensionService::RemoveUpdateObserver(
3109 extensions::UpdateObserver* observer) { 3109 extensions::UpdateObserver* observer) {
3110 update_observers_.RemoveObserver(observer); 3110 update_observers_.RemoveObserver(observer);
3111 } 3111 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_protocols_unittest.cc ('k') | chrome/browser/extensions/extension_service_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698