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

Side by Side Diff: ui/touch_selection/touch_selection_menu_runner.cc

Issue 1173083002: Add DCHECKs for the touch selection menu runner singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ui/touch_selection/touch_selection_menu_runner.h" 5 #include "ui/touch_selection/touch_selection_menu_runner.h"
6 6
7 #include "base/logging.h"
8
7 namespace ui { 9 namespace ui {
8 namespace { 10 namespace {
9 11
10 TouchSelectionMenuRunner* g_touch_selection_menu_runner = nullptr; 12 TouchSelectionMenuRunner* g_touch_selection_menu_runner = nullptr;
11 13
12 } // namespace 14 } // namespace
13 15
14 TouchSelectionMenuRunner::~TouchSelectionMenuRunner() { 16 TouchSelectionMenuRunner::~TouchSelectionMenuRunner() {
17 DCHECK_EQ(this, g_touch_selection_menu_runner);
15 g_touch_selection_menu_runner = nullptr; 18 g_touch_selection_menu_runner = nullptr;
16 } 19 }
17 20
18 TouchSelectionMenuRunner* TouchSelectionMenuRunner::GetInstance() { 21 TouchSelectionMenuRunner* TouchSelectionMenuRunner::GetInstance() {
19 return g_touch_selection_menu_runner; 22 return g_touch_selection_menu_runner;
20 } 23 }
21 24
22 TouchSelectionMenuRunner::TouchSelectionMenuRunner() { 25 TouchSelectionMenuRunner::TouchSelectionMenuRunner() {
23 // TODO(mohsen): Ideally we should DCHECK that |g_touch_selection_menu_runner| 26 DCHECK(!g_touch_selection_menu_runner);
24 // is not set here, in order to make sure we don't create multiple menu
25 // runners accidentally. Currently, this is not possible because we can have
26 // multiple ViewsDelegate's at the same time which should not happen. See
27 // crbug.com/492991.
28 g_touch_selection_menu_runner = this; 27 g_touch_selection_menu_runner = this;
29 } 28 }
30 29
31 } // namespace ui 30 } // namespace ui
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