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

Unified Diff: chrome/browser/ui/views/uninstall_view.cc

Issue 1803143002: Replace BrowserProces::AddRefModule/RemoveModule by ScopedKeepAlive (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/chrome_views_delegate.cc ('k') | chrome/test/base/testing_browser_process.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/uninstall_view.cc
diff --git a/chrome/browser/ui/views/uninstall_view.cc b/chrome/browser/ui/views/uninstall_view.cc
index d3558eb4c47925813a9cdef09d8126664340685e..79e94b5c1e556df2af977f374495920bb6ee6562 100644
--- a/chrome/browser/ui/views/uninstall_view.cc
+++ b/chrome/browser/ui/views/uninstall_view.cc
@@ -7,7 +7,8 @@
#include "base/message_loop/message_loop.h"
#include "base/process/launch.h"
#include "base/run_loop.h"
-#include "chrome/browser/browser_process.h"
+#include "chrome/browser/lifetime/keep_alive_types.h"
+#include "chrome/browser/lifetime/scoped_keep_alive.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/ui/uninstall_browser_prompt.h"
#include "chrome/common/chrome_result_codes.h"
@@ -166,14 +167,15 @@ int ShowUninstallBrowserPrompt() {
DCHECK(base::MessageLoopForUI::IsCurrent());
int result = content::RESULT_CODE_NORMAL_EXIT;
- // Take a reference on g_browser_process while showing the dialog. This is
- // done because the dialog uses the views framework which may increment
- // and decrement the module ref count during the course of displaying UI and
- // this code can be called while the module refcount is still at 0.
+ // Register a KeepAlive while showing the dialog. This is done because the
+ // dialog uses the views framework which may take and release a KeepAlive
+ // during the course of displaying UI and this code can be called while
+ // there is no registered KeepAlive.
// Note that this reference is never released, as this code is shown on a path
// that immediately exits Chrome anyway.
// See http://crbug.com/241366 for details.
- g_browser_process->AddRefModule();
+ new ScopedKeepAlive(KeepAliveOrigin::LEAKED_UNINSTALL_VIEW,
+ KeepAliveRestartOption::DISABLED);
base::RunLoop run_loop;
UninstallView* view = new UninstallView(&result,
« no previous file with comments | « chrome/browser/ui/views/chrome_views_delegate.cc ('k') | chrome/test/base/testing_browser_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698