| 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 "chrome/browser/extensions/extension_event_router.h" | 5 #include "chrome/browser/extensions/extension_event_router.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 } | 418 } |
| 419 | 419 |
| 420 void ExtensionEventRouter::OnEventAck( | 420 void ExtensionEventRouter::OnEventAck( |
| 421 Profile* profile, const std::string& extension_id) { | 421 Profile* profile, const std::string& extension_id) { |
| 422 ExtensionProcessManager* pm = | 422 ExtensionProcessManager* pm = |
| 423 ExtensionSystem::Get(profile)->process_manager(); | 423 ExtensionSystem::Get(profile)->process_manager(); |
| 424 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension_id); | 424 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension_id); |
| 425 // The event ACK is routed to the background host, so this should never be | 425 // The event ACK is routed to the background host, so this should never be |
| 426 // NULL. | 426 // NULL. |
| 427 CHECK(host); | 427 CHECK(host); |
| 428 if (!host->extension()) |
| 429 return; |
| 430 |
| 428 CHECK(host->extension()->has_lazy_background_page()); | 431 CHECK(host->extension()->has_lazy_background_page()); |
| 429 pm->DecrementLazyKeepaliveCount(host->extension()); | 432 pm->DecrementLazyKeepaliveCount(host->extension()); |
| 430 } | 433 } |
| 431 | 434 |
| 432 void ExtensionEventRouter::DispatchPendingEvent( | 435 void ExtensionEventRouter::DispatchPendingEvent( |
| 433 const linked_ptr<ExtensionEvent>& event, ExtensionHost* host) { | 436 const linked_ptr<ExtensionEvent>& event, ExtensionHost* host) { |
| 434 if (!host) | 437 if (!host) |
| 435 return; | 438 return; |
| 436 | 439 |
| 437 ListenerProcess listener(host->render_process_host(), | 440 ListenerProcess listener(host->render_process_host(), |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 MessageLoop::current()->PostTask(FROM_HERE, | 501 MessageLoop::current()->PostTask(FROM_HERE, |
| 499 base::Bind(&extensions::RuntimeEventRouter::DispatchOnInstalledEvent, | 502 base::Bind(&extensions::RuntimeEventRouter::DispatchOnInstalledEvent, |
| 500 profile_, extension->id())); | 503 profile_, extension->id())); |
| 501 break; | 504 break; |
| 502 } | 505 } |
| 503 default: | 506 default: |
| 504 NOTREACHED(); | 507 NOTREACHED(); |
| 505 return; | 508 return; |
| 506 } | 509 } |
| 507 } | 510 } |
| OLD | NEW |