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

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, 7 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 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 } 1957 }
1958 1958
1959 void ExtensionService::GarbageCollectExtensions() { 1959 void ExtensionService::GarbageCollectExtensions() {
1960 if (extension_prefs_->pref_service()->ReadOnly()) 1960 if (extension_prefs_->pref_service()->ReadOnly())
1961 return; 1961 return;
1962 1962
1963 if (pending_extension_manager()->HasPendingExtensions()) { 1963 if (pending_extension_manager()->HasPendingExtensions()) {
1964 // Don't garbage collect while there are pending installations, which may 1964 // Don't garbage collect while there are pending installations, which may
1965 // be using the temporary installation directory. Try to garbage collect 1965 // be using the temporary installation directory. Try to garbage collect
1966 // again later. 1966 // again later.
1967 MessageLoop::current()->PostDelayedTask( 1967 base::MessageLoop::current()->PostDelayedTask(
1968 FROM_HERE, 1968 FROM_HERE,
1969 base::Bind(&ExtensionService::GarbageCollectExtensions, AsWeakPtr()), 1969 base::Bind(&ExtensionService::GarbageCollectExtensions, AsWeakPtr()),
1970 base::TimeDelta::FromSeconds(kGarbageCollectRetryDelay)); 1970 base::TimeDelta::FromSeconds(kGarbageCollectRetryDelay));
1971 return; 1971 return;
1972 } 1972 }
1973 1973
1974 scoped_ptr<extensions::ExtensionPrefs::ExtensionsInfo> info( 1974 scoped_ptr<extensions::ExtensionPrefs::ExtensionsInfo> info(
1975 extension_prefs_->GetInstalledExtensionsInfo()); 1975 extension_prefs_->GetInstalledExtensionsInfo());
1976 1976
1977 std::multimap<std::string, base::FilePath> extension_paths; 1977 std::multimap<std::string, base::FilePath> extension_paths;
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
2631 } 2631 }
2632 2632
2633 extensions::ExtensionHost* host = 2633 extensions::ExtensionHost* host =
2634 content::Details<extensions::ExtensionHost>(details).ptr(); 2634 content::Details<extensions::ExtensionHost>(details).ptr();
2635 2635
2636 // Mark the extension as terminated and Unload it. We want it to 2636 // Mark the extension as terminated and Unload it. We want it to
2637 // be in a consistent state: either fully working or not loaded 2637 // be in a consistent state: either fully working or not loaded
2638 // at all, but never half-crashed. We do it in a PostTask so 2638 // at all, but never half-crashed. We do it in a PostTask so
2639 // that other handlers of this notification will still have 2639 // that other handlers of this notification will still have
2640 // access to the Extension and ExtensionHost. 2640 // access to the Extension and ExtensionHost.
2641 MessageLoop::current()->PostTask( 2641 base::MessageLoop::current()->PostTask(
2642 FROM_HERE, 2642 FROM_HERE,
2643 base::Bind( 2643 base::Bind(
2644 &ExtensionService::TrackTerminatedExtension, 2644 &ExtensionService::TrackTerminatedExtension,
2645 AsWeakPtr(), 2645 AsWeakPtr(),
2646 host->extension())); 2646 host->extension()));
2647 break; 2647 break;
2648 } 2648 }
2649 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { 2649 case content::NOTIFICATION_RENDERER_PROCESS_CREATED: {
2650 content::RenderProcessHost* process = 2650 content::RenderProcessHost* process =
2651 content::Source<content::RenderProcessHost>(source).ptr(); 2651 content::Source<content::RenderProcessHost>(source).ptr();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2699 InitAfterImport(); 2699 InitAfterImport();
2700 break; 2700 break;
2701 } 2701 }
2702 case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: { 2702 case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: {
2703 extensions::ExtensionHost* host = 2703 extensions::ExtensionHost* host =
2704 content::Details<extensions::ExtensionHost>(details).ptr(); 2704 content::Details<extensions::ExtensionHost>(details).ptr();
2705 std::string extension_id = host->extension_id(); 2705 std::string extension_id = host->extension_id();
2706 if (delayed_updates_for_idle_.Contains(extension_id)) { 2706 if (delayed_updates_for_idle_.Contains(extension_id)) {
2707 // We were waiting for this extension to become idle, it now might have, 2707 // We were waiting for this extension to become idle, it now might have,
2708 // so maybe finish installation. 2708 // so maybe finish installation.
2709 MessageLoop::current()->PostDelayedTask( 2709 base::MessageLoop::current()->PostDelayedTask(
2710 FROM_HERE, 2710 FROM_HERE,
2711 base::Bind(&ExtensionService::MaybeFinishDelayedInstallation, 2711 base::Bind(&ExtensionService::MaybeFinishDelayedInstallation,
2712 AsWeakPtr(), extension_id), 2712 AsWeakPtr(), extension_id),
2713 base::TimeDelta::FromSeconds(kUpdateIdleDelay)); 2713 base::TimeDelta::FromSeconds(kUpdateIdleDelay));
2714 } 2714 }
2715 break; 2715 break;
2716 } 2716 }
2717 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: { 2717 case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: {
2718 // Notify extensions that chrome update is available. 2718 // Notify extensions that chrome update is available.
2719 extensions::RuntimeEventRouter::DispatchOnBrowserUpdateAvailableEvent( 2719 extensions::RuntimeEventRouter::DispatchOnBrowserUpdateAvailableEvent(
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
3097 } 3097 }
3098 3098
3099 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { 3099 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) {
3100 update_observers_.AddObserver(observer); 3100 update_observers_.AddObserver(observer);
3101 } 3101 }
3102 3102
3103 void ExtensionService::RemoveUpdateObserver( 3103 void ExtensionService::RemoveUpdateObserver(
3104 extensions::UpdateObserver* observer) { 3104 extensions::UpdateObserver* observer) {
3105 update_observers_.RemoveObserver(observer); 3105 update_observers_.RemoveObserver(observer);
3106 } 3106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698