| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |