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

Side by Side Diff: extensions/browser/extension_function.cc

Issue 2118473002: 😴 Skip some KeepAlive registrations on shutdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 5 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
« no previous file with comments | « extensions/browser/extension_function.h ('k') | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "extensions/browser/extension_function.h" 5 #include "extensions/browser/extension_function.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 DCHECK(extensions::ExtensionsBrowserClient::Get()->IsShuttingDown() || 481 DCHECK(extensions::ExtensionsBrowserClient::Get()->IsShuttingDown() ||
482 did_respond_ || ignore_all_did_respond_for_testing_do_not_use) 482 did_respond_ || ignore_all_did_respond_for_testing_do_not_use)
483 << name_; 483 << name_;
484 } 484 }
485 485
486 UIThreadExtensionFunction* 486 UIThreadExtensionFunction*
487 UIThreadExtensionFunction::AsUIThreadExtensionFunction() { 487 UIThreadExtensionFunction::AsUIThreadExtensionFunction() {
488 return this; 488 return this;
489 } 489 }
490 490
491 bool UIThreadExtensionFunction::PreRunValidation(std::string* error) {
492 if (!ExtensionFunction::PreRunValidation(error))
493 return false;
494
495 // TODO(crbug.com/625646) This is a partial fix to avoid crashes when certain
496 // extension functions run during shutdown. Browser or Notification creation
497 // for example create a ScopedKeepAlive, which hit a CHECK if the browser is
498 // shutting down. This fixes the current problem as the known issues happen
499 // through synchronous calls from Run(), but posted tasks will not be covered.
500 // A possible fix would involve refactoring ExtensionFunction: unrefcount
501 // here and use weakptrs for the tasks, then have it owned by something that
502 // will be destroyed naturally in the course of shut down.
503 if (extensions::ExtensionsBrowserClient::Get()->IsShuttingDown()) {
504 *error = "The browser is shutting down.";
505 return false;
506 }
507
508 return true;
509 }
510
491 bool UIThreadExtensionFunction::OnMessageReceived(const IPC::Message& message) { 511 bool UIThreadExtensionFunction::OnMessageReceived(const IPC::Message& message) {
492 return false; 512 return false;
493 } 513 }
494 514
495 void UIThreadExtensionFunction::Destruct() const { 515 void UIThreadExtensionFunction::Destruct() const {
496 BrowserThread::DeleteOnUIThread::Destruct(this); 516 BrowserThread::DeleteOnUIThread::Destruct(this);
497 } 517 }
498 518
499 content::RenderViewHost* 519 content::RenderViewHost*
500 UIThreadExtensionFunction::render_view_host_do_not_use() const { 520 UIThreadExtensionFunction::render_view_host_do_not_use() const {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { 649 ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() {
630 return RespondNow(RunSync() ? ArgumentList(std::move(results_)) 650 return RespondNow(RunSync() ? ArgumentList(std::move(results_))
631 : Error(error_)); 651 : Error(error_));
632 } 652 }
633 653
634 // static 654 // static
635 bool SyncIOThreadExtensionFunction::ValidationFailure( 655 bool SyncIOThreadExtensionFunction::ValidationFailure(
636 SyncIOThreadExtensionFunction* function) { 656 SyncIOThreadExtensionFunction* function) {
637 return false; 657 return false;
638 } 658 }
OLDNEW
« no previous file with comments | « extensions/browser/extension_function.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698