Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: chrome/browser/extensions/extension_event_router.cc

Issue 10542130: Merge 141090 - Add some NULL-checks for ExtensionHost::extension to fix a crash bug. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1132/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698