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

Side by Side Diff: ui/base/test/test_clipboard.cc

Issue 574273002: Rewrite clipboard write IPC handling to be easier to understand. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Document Created 6 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 unified diff | Download patch
« no previous file with comments | « ui/base/test/test_clipboard.h ('k') | ui/base/test/test_clipboard_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/test/test_clipboard.h" 5 #include "ui/base/test/test_clipboard.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include "base/numerics/safe_conversions.h" 8 #include "base/numerics/safe_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 10
11 namespace ui { 11 namespace ui {
12 12
13 TestClipboard::TestClipboard() 13 TestClipboard::TestClipboard()
14 : default_store_type_(CLIPBOARD_TYPE_COPY_PASTE) { 14 : default_store_type_(CLIPBOARD_TYPE_COPY_PASTE) {
15 } 15 }
16 16
17 TestClipboard::~TestClipboard() { 17 TestClipboard::~TestClipboard() {
18 } 18 }
19 19
20 void TestClipboard::UseForCurrentThread() { 20 Clipboard* TestClipboard::CreateForCurrentThread() {
21 base::AutoLock lock(Clipboard::clipboard_map_lock_.Get()); 21 base::AutoLock lock(Clipboard::clipboard_map_lock_.Get());
22 Clipboard* clipboard = new TestClipboard;
22 Clipboard::clipboard_map_.Get()[base::PlatformThread::CurrentId()] = 23 Clipboard::clipboard_map_.Get()[base::PlatformThread::CurrentId()] =
23 new TestClipboard; 24 clipboard;
25 return clipboard;
24 } 26 }
25 27
26 uint64 TestClipboard::GetSequenceNumber(ClipboardType type) const { 28 uint64 TestClipboard::GetSequenceNumber(ClipboardType type) const {
27 return GetStore(type).sequence_number; 29 return GetStore(type).sequence_number;
28 } 30 }
29 31
30 bool TestClipboard::IsFormatAvailable(const FormatType& format, 32 bool TestClipboard::IsFormatAvailable(const FormatType& format,
31 ClipboardType type) const { 33 ClipboardType type) const {
32 const DataStore& store = GetStore(type); 34 const DataStore& store = GetStore(type);
33 return store.data.find(format) != store.data.end(); 35 return store.data.find(format) != store.data.end();
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 194
193 const TestClipboard::DataStore& TestClipboard::GetDefaultStore() const { 195 const TestClipboard::DataStore& TestClipboard::GetDefaultStore() const {
194 return GetStore(default_store_type_); 196 return GetStore(default_store_type_);
195 } 197 }
196 198
197 TestClipboard::DataStore& TestClipboard::GetDefaultStore() { 199 TestClipboard::DataStore& TestClipboard::GetDefaultStore() {
198 return GetStore(default_store_type_); 200 return GetStore(default_store_type_);
199 } 201 }
200 202
201 } // namespace ui 203 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/test/test_clipboard.h ('k') | ui/base/test/test_clipboard_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698