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

Side by Side Diff: extensions/browser/event_router.cc

Issue 671763002: Extract ProcessManager from ExtensionSystem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 1 month 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
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 "extensions/browser/event_router.h" 5 #include "extensions/browser/event_router.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 if (!extension) 673 if (!extension)
674 return; 674 return;
675 event_router->IncrementInFlightEvents(browser_context, extension); 675 event_router->IncrementInFlightEvents(browser_context, extension);
676 } 676 }
677 677
678 void EventRouter::IncrementInFlightEvents(BrowserContext* context, 678 void EventRouter::IncrementInFlightEvents(BrowserContext* context,
679 const Extension* extension) { 679 const Extension* extension) {
680 // Only increment in-flight events if the lazy background page is active, 680 // Only increment in-flight events if the lazy background page is active,
681 // because that's the only time we'll get an ACK. 681 // because that's the only time we'll get an ACK.
682 if (BackgroundInfo::HasLazyBackgroundPage(extension)) { 682 if (BackgroundInfo::HasLazyBackgroundPage(extension)) {
683 ProcessManager* pm = ExtensionSystem::Get(context)->process_manager(); 683 ProcessManager* pm = ProcessManager::Get(context);
684 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension->id()); 684 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension->id());
685 if (host) 685 if (host)
686 pm->IncrementLazyKeepaliveCount(extension); 686 pm->IncrementLazyKeepaliveCount(extension);
687 } 687 }
688 } 688 }
689 689
690 void EventRouter::OnEventAck(BrowserContext* context, 690 void EventRouter::OnEventAck(BrowserContext* context,
691 const std::string& extension_id) { 691 const std::string& extension_id) {
692 ProcessManager* pm = ExtensionSystem::Get(context)->process_manager(); 692 ProcessManager* pm = ProcessManager::Get(context);
693 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension_id); 693 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension_id);
694 // The event ACK is routed to the background host, so this should never be 694 // The event ACK is routed to the background host, so this should never be
695 // NULL. 695 // NULL.
696 CHECK(host); 696 CHECK(host);
697 // TODO(mpcomplete): We should never get this message unless 697 // TODO(mpcomplete): We should never get this message unless
698 // HasLazyBackgroundPage is true. Find out why we're getting it anyway. 698 // HasLazyBackgroundPage is true. Find out why we're getting it anyway.
699 if (host->extension() && 699 if (host->extension() &&
700 BackgroundInfo::HasLazyBackgroundPage(host->extension())) 700 BackgroundInfo::HasLazyBackgroundPage(host->extension()))
701 pm->DecrementLazyKeepaliveCount(host->extension()); 701 pm->DecrementLazyKeepaliveCount(host->extension());
702 } 702 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 const std::string& extension_id, 813 const std::string& extension_id,
814 const GURL& listener_url, 814 const GURL& listener_url,
815 content::BrowserContext* browser_context) 815 content::BrowserContext* browser_context)
816 : event_name(event_name), 816 : event_name(event_name),
817 extension_id(extension_id), 817 extension_id(extension_id),
818 listener_url(listener_url), 818 listener_url(listener_url),
819 browser_context(browser_context) { 819 browser_context(browser_context) {
820 } 820 }
821 821
822 } // namespace extensions 822 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/browser_context_keyed_service_factories.cc ('k') | extensions/browser/extension_function_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698