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

Unified Diff: ui/base/clipboard/clipboard.cc

Issue 2518363002: Disable ui::Clipboard on the FILE thread. (Closed)
Patch Set: fix build error Created 4 years, 1 month 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 | « content/browser/browser_main_loop.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/clipboard/clipboard.cc
diff --git a/ui/base/clipboard/clipboard.cc b/ui/base/clipboard/clipboard.cc
index f8125f32cce99e69a5ed52dcd736221a4232812e..cd9e85dcef5be44bb6d21e7b6ae7a9c7bc8cd3c0 100644
--- a/ui/base/clipboard/clipboard.cc
+++ b/ui/base/clipboard/clipboard.cc
@@ -4,10 +4,12 @@
#include "ui/base/clipboard/clipboard.h"
+#include <algorithm>
#include <iterator>
#include <limits>
#include <memory>
+#include "base/debug/dump_without_crashing.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -132,22 +134,19 @@ void Clipboard::DispatchObject(ObjectType type, const ObjectMapParams& params) {
}
base::PlatformThreadId Clipboard::GetAndValidateThreadID() {
- base::PlatformThreadId id = base::PlatformThread::CurrentId();
-#ifndef NDEBUG
- AllowedThreadsVector* allowed_threads = allowed_threads_.Pointer();
- if (!allowed_threads->empty()) {
- bool found = false;
- for (AllowedThreadsVector::const_iterator it = allowed_threads->begin();
- it != allowed_threads->end(); ++it) {
- if (*it == id) {
- found = true;
- break;
- }
- }
+ clipboard_map_lock_.Get().AssertAcquired();
- DCHECK(found);
+ const base::PlatformThreadId id = base::PlatformThread::CurrentId();
+
+ // TODO(fdoray): Surround this block with #if DCHECK_IS_ON() and remove the
+ // DumpWithoutCrashing() call once https://crbug.com/662055 is resolved.
+ AllowedThreadsVector* allowed_threads = allowed_threads_.Pointer();
+ if (!allowed_threads->empty() &&
+ std::find(allowed_threads->begin(), allowed_threads->end(), id) ==
+ allowed_threads->end()) {
+ NOTREACHED();
+ base::debug::DumpWithoutCrashing();
}
-#endif
return id;
}
« 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