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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 } | 424 } |
425 | 425 |
426 void ExtensionEventRouter::OnEventAck( | 426 void ExtensionEventRouter::OnEventAck( |
427 Profile* profile, const std::string& extension_id) { | 427 Profile* profile, const std::string& extension_id) { |
428 ExtensionProcessManager* pm = | 428 ExtensionProcessManager* pm = |
429 ExtensionSystem::Get(profile)->process_manager(); | 429 ExtensionSystem::Get(profile)->process_manager(); |
430 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension_id); | 430 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension_id); |
431 // The event ACK is routed to the background host, so this should never be | 431 // The event ACK is routed to the background host, so this should never be |
432 // NULL. | 432 // NULL. |
433 CHECK(host); | 433 CHECK(host); |
| 434 if (!host->extension()) |
| 435 return; |
| 436 |
434 CHECK(host->extension()->has_lazy_background_page()); | 437 CHECK(host->extension()->has_lazy_background_page()); |
435 pm->DecrementLazyKeepaliveCount(host->extension()); | 438 pm->DecrementLazyKeepaliveCount(host->extension()); |
436 } | 439 } |
437 | 440 |
438 void ExtensionEventRouter::DispatchPendingEvent( | 441 void ExtensionEventRouter::DispatchPendingEvent( |
439 const linked_ptr<ExtensionEvent>& event, ExtensionHost* host) { | 442 const linked_ptr<ExtensionEvent>& event, ExtensionHost* host) { |
440 if (!host) | 443 if (!host) |
441 return; | 444 return; |
442 | 445 |
443 ListenerProcess listener(host->render_process_host(), | 446 ListenerProcess listener(host->render_process_host(), |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 MessageLoop::current()->PostTask(FROM_HERE, | 507 MessageLoop::current()->PostTask(FROM_HERE, |
505 base::Bind(&extensions::RuntimeEventRouter::DispatchOnInstalledEvent, | 508 base::Bind(&extensions::RuntimeEventRouter::DispatchOnInstalledEvent, |
506 profile_, extension->id())); | 509 profile_, extension->id())); |
507 break; | 510 break; |
508 } | 511 } |
509 default: | 512 default: |
510 NOTREACHED(); | 513 NOTREACHED(); |
511 return; | 514 return; |
512 } | 515 } |
513 } | 516 } |
OLD | NEW |