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

Side by Side Diff: ui/base/clipboard/clipboard.cc

Issue 2518363002: Disable ui::Clipboard on the FILE thread. (Closed)
Patch Set: fix build error Created 4 years 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 | « content/browser/browser_main_loop.cc ('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 (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 "ui/base/clipboard/clipboard.h" 5 #include "ui/base/clipboard/clipboard.h"
6 6
7 #include <algorithm>
7 #include <iterator> 8 #include <iterator>
8 #include <limits> 9 #include <limits>
9 #include <memory> 10 #include <memory>
10 11
12 #include "base/debug/dump_without_crashing.h"
11 #include "base/logging.h" 13 #include "base/logging.h"
12 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 15 #include "third_party/skia/include/core/SkBitmap.h"
14 #include "ui/gfx/geometry/size.h" 16 #include "ui/gfx/geometry/size.h"
15 17
16 namespace ui { 18 namespace ui {
17 19
18 base::LazyInstance<Clipboard::AllowedThreadsVector> 20 base::LazyInstance<Clipboard::AllowedThreadsVector>
19 Clipboard::allowed_threads_ = LAZY_INSTANCE_INITIALIZER; 21 Clipboard::allowed_threads_ = LAZY_INSTANCE_INITIALIZER;
20 base::LazyInstance<Clipboard::ClipboardMap> Clipboard::clipboard_map_ = 22 base::LazyInstance<Clipboard::ClipboardMap> Clipboard::clipboard_map_ =
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 &(params[1].front()), 127 &(params[1].front()),
126 params[1].size()); 128 params[1].size());
127 break; 129 break;
128 130
129 default: 131 default:
130 NOTREACHED(); 132 NOTREACHED();
131 } 133 }
132 } 134 }
133 135
134 base::PlatformThreadId Clipboard::GetAndValidateThreadID() { 136 base::PlatformThreadId Clipboard::GetAndValidateThreadID() {
135 base::PlatformThreadId id = base::PlatformThread::CurrentId(); 137 clipboard_map_lock_.Get().AssertAcquired();
136 #ifndef NDEBUG 138
139 const base::PlatformThreadId id = base::PlatformThread::CurrentId();
140
141 // TODO(fdoray): Surround this block with #if DCHECK_IS_ON() and remove the
142 // DumpWithoutCrashing() call once https://crbug.com/662055 is resolved.
137 AllowedThreadsVector* allowed_threads = allowed_threads_.Pointer(); 143 AllowedThreadsVector* allowed_threads = allowed_threads_.Pointer();
138 if (!allowed_threads->empty()) { 144 if (!allowed_threads->empty() &&
139 bool found = false; 145 std::find(allowed_threads->begin(), allowed_threads->end(), id) ==
140 for (AllowedThreadsVector::const_iterator it = allowed_threads->begin(); 146 allowed_threads->end()) {
141 it != allowed_threads->end(); ++it) { 147 NOTREACHED();
142 if (*it == id) { 148 base::debug::DumpWithoutCrashing();
143 found = true;
144 break;
145 }
146 }
147
148 DCHECK(found);
149 } 149 }
150 #endif
151 150
152 return id; 151 return id;
153 } 152 }
154 153
155 } // namespace ui 154 } // namespace ui
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698