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

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

Issue 10911074: Change how ui::Clipboard is accessed so there's only one per thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch cleanup Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: ui/base/clipboard/clipboard.h
diff --git a/ui/base/clipboard/clipboard.h b/ui/base/clipboard/clipboard.h
index b98cfc4748953f32ad60eb5c45be673cd1afc771..31fdd3343596a497db0b1fd7419a5e56cd189a0d 100644
--- a/ui/base/clipboard/clipboard.h
+++ b/ui/base/clipboard/clipboard.h
@@ -46,6 +46,7 @@ class NSString;
#endif
namespace ui {
+class ClipboardTest;
class UI_EXPORT Clipboard : NON_EXPORTED_BASE(public base::ThreadChecker) {
public:
@@ -182,8 +183,17 @@ class UI_EXPORT Clipboard : NON_EXPORTED_BASE(public base::ThreadChecker) {
return static_cast<Buffer>(buffer);
}
- Clipboard();
- ~Clipboard();
+ // Returns the clipboard object for the current thread.
+ //
+ // Most implementations will have at most one clipboard which will live on
+ // the main UI thread, but Windows has tricky semantics where there have to
+ // be two clipboards: one that lives on the UI thread and one that lives on
+ // the IO thread.
+ static Clipboard* GetForCurrentThread();
+
+ // Destroys all thread local clipboards during shutdown. Each clipboard will
+ // be destructed on its associated thread.
+ static void DestroyClipboards();
// Write a bunch of objects to the system clipboard. Copies are made of the
// contents of |objects|. On Windows they are copied to the system clipboard.
@@ -284,6 +294,10 @@ class UI_EXPORT Clipboard : NON_EXPORTED_BASE(public base::ThreadChecker) {
private:
FRIEND_TEST_ALL_PREFIXES(ClipboardTest, SharedBitmapTest);
FRIEND_TEST_ALL_PREFIXES(ClipboardTest, EmptyHTMLTest);
+ friend class ClipboardTest;
+
+ Clipboard();
+ ~Clipboard();
void DispatchObject(ObjectType type, const ObjectMapParams& params);

Powered by Google App Engine
This is Rietveld 408576698