OLD | NEW |
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 <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <limits> | 9 #include <limits> |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/debug/dump_without_crashing.h" | 12 #include "base/debug/dump_without_crashing.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
15 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
16 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
17 | 17 |
18 namespace ui { | 18 namespace ui { |
19 | 19 |
20 base::LazyInstance<Clipboard::AllowedThreadsVector> | 20 base::LazyInstance<Clipboard::AllowedThreadsVector> |
21 Clipboard::allowed_threads_ = LAZY_INSTANCE_INITIALIZER; | 21 Clipboard::allowed_threads_ = LAZY_INSTANCE_INITIALIZER; |
22 base::LazyInstance<Clipboard::ClipboardMap> Clipboard::clipboard_map_ = | 22 base::LazyInstance<Clipboard::ClipboardMap>::DestructorAtExit |
23 LAZY_INSTANCE_INITIALIZER; | 23 Clipboard::clipboard_map_ = LAZY_INSTANCE_INITIALIZER; |
24 base::LazyInstance<base::Lock>::Leaky Clipboard::clipboard_map_lock_ = | 24 base::LazyInstance<base::Lock>::Leaky Clipboard::clipboard_map_lock_ = |
25 LAZY_INSTANCE_INITIALIZER; | 25 LAZY_INSTANCE_INITIALIZER; |
26 | 26 |
27 // static | 27 // static |
28 void Clipboard::SetAllowedThreads( | 28 void Clipboard::SetAllowedThreads( |
29 const std::vector<base::PlatformThreadId>& allowed_threads) { | 29 const std::vector<base::PlatformThreadId>& allowed_threads) { |
30 base::AutoLock lock(clipboard_map_lock_.Get()); | 30 base::AutoLock lock(clipboard_map_lock_.Get()); |
31 | 31 |
32 allowed_threads_.Get().clear(); | 32 allowed_threads_.Get().clear(); |
33 std::copy(allowed_threads.begin(), allowed_threads.end(), | 33 std::copy(allowed_threads.begin(), allowed_threads.end(), |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 std::find(allowed_threads->begin(), allowed_threads->end(), id) == | 157 std::find(allowed_threads->begin(), allowed_threads->end(), id) == |
158 allowed_threads->end()) { | 158 allowed_threads->end()) { |
159 NOTREACHED(); | 159 NOTREACHED(); |
160 base::debug::DumpWithoutCrashing(); | 160 base::debug::DumpWithoutCrashing(); |
161 } | 161 } |
162 | 162 |
163 return id; | 163 return id; |
164 } | 164 } |
165 | 165 |
166 } // namespace ui | 166 } // namespace ui |
OLD | NEW |