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()) | 428 // TODO(mpcomplete): We should never get this message unless |
429 return; | 429 // has_lazy_background_page is true. Find out why we're getting it anyway. |
430 | 430 if (host->extension() && host->extension()->has_lazy_background_page()) |
431 CHECK(host->extension()->has_lazy_background_page()); | 431 pm->DecrementLazyKeepaliveCount(host->extension()); |
432 pm->DecrementLazyKeepaliveCount(host->extension()); | |
433 } | 432 } |
434 | 433 |
435 void ExtensionEventRouter::DispatchPendingEvent( | 434 void ExtensionEventRouter::DispatchPendingEvent( |
436 const linked_ptr<ExtensionEvent>& event, ExtensionHost* host) { | 435 const linked_ptr<ExtensionEvent>& event, ExtensionHost* host) { |
437 if (!host) | 436 if (!host) |
438 return; | 437 return; |
439 | 438 |
440 ListenerProcess listener(host->render_process_host(), | 439 ListenerProcess listener(host->render_process_host(), |
441 host->extension()->id()); | 440 host->extension()->id()); |
442 if (listeners_[event->event_name].count(listener) > 0u) | 441 if (listeners_[event->event_name].count(listener) > 0u) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 MessageLoop::current()->PostTask(FROM_HERE, | 500 MessageLoop::current()->PostTask(FROM_HERE, |
502 base::Bind(&extensions::RuntimeEventRouter::DispatchOnInstalledEvent, | 501 base::Bind(&extensions::RuntimeEventRouter::DispatchOnInstalledEvent, |
503 profile_, extension->id())); | 502 profile_, extension->id())); |
504 break; | 503 break; |
505 } | 504 } |
506 default: | 505 default: |
507 NOTREACHED(); | 506 NOTREACHED(); |
508 return; | 507 return; |
509 } | 508 } |
510 } | 509 } |
OLD | NEW |