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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 } | 423 } |
424 | 424 |
425 void ExtensionEventRouter::OnEventAck( | 425 void ExtensionEventRouter::OnEventAck( |
426 Profile* profile, const std::string& extension_id) { | 426 Profile* profile, const std::string& extension_id) { |
427 ExtensionProcessManager* pm = | 427 ExtensionProcessManager* pm = |
428 ExtensionSystem::Get(profile)->process_manager(); | 428 ExtensionSystem::Get(profile)->process_manager(); |
429 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension_id); | 429 ExtensionHost* host = pm->GetBackgroundHostForExtension(extension_id); |
430 // The event ACK is routed to the background host, so this should never be | 430 // The event ACK is routed to the background host, so this should never be |
431 // NULL. | 431 // NULL. |
432 CHECK(host); | 432 CHECK(host); |
433 if (!host->extension()) | 433 // TODO(mpcomplete): We should never get this message unless |
434 return; | 434 // has_lazy_background_page is true. Find out why we're getting it anyway. |
435 | 435 if (host->extension() && host->extension()->has_lazy_background_page()) |
436 CHECK(host->extension()->has_lazy_background_page()); | 436 pm->DecrementLazyKeepaliveCount(host->extension()); |
437 pm->DecrementLazyKeepaliveCount(host->extension()); | |
438 } | 437 } |
439 | 438 |
440 void ExtensionEventRouter::DispatchPendingEvent( | 439 void ExtensionEventRouter::DispatchPendingEvent( |
441 const linked_ptr<ExtensionEvent>& event, ExtensionHost* host) { | 440 const linked_ptr<ExtensionEvent>& event, ExtensionHost* host) { |
442 if (!host) | 441 if (!host) |
443 return; | 442 return; |
444 | 443 |
445 ListenerProcess listener(host->render_process_host(), | 444 ListenerProcess listener(host->render_process_host(), |
446 host->extension()->id()); | 445 host->extension()->id()); |
447 if (listeners_[event->event_name].count(listener) > 0u) | 446 if (listeners_[event->event_name].count(listener) > 0u) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 MessageLoop::current()->PostTask(FROM_HERE, | 505 MessageLoop::current()->PostTask(FROM_HERE, |
507 base::Bind(&extensions::RuntimeEventRouter::DispatchOnInstalledEvent, | 506 base::Bind(&extensions::RuntimeEventRouter::DispatchOnInstalledEvent, |
508 profile_, extension->id())); | 507 profile_, extension->id())); |
509 break; | 508 break; |
510 } | 509 } |
511 default: | 510 default: |
512 NOTREACHED(); | 511 NOTREACHED(); |
513 return; | 512 return; |
514 } | 513 } |
515 } | 514 } |
OLD | NEW |