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

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

Issue 9419036: Change all platforms except Windows to access the clipboard solely from the UI thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 10 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
« no previous file with comments | « ui/base/clipboard/clipboard_aurax11.cc ('k') | ui/base/clipboard/clipboard_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/clipboard/clipboard_gtk.cc
diff --git a/ui/base/clipboard/clipboard_gtk.cc b/ui/base/clipboard/clipboard_gtk.cc
index 63b610aa7a6fd0392864a65c31f7e2b58992ba1a..c047b96b2ffa16e82092fdf96fa449e13679f7b6 100644
--- a/ui/base/clipboard/clipboard_gtk.cc
+++ b/ui/base/clipboard/clipboard_gtk.cc
@@ -210,15 +210,18 @@ bool Clipboard::FormatType::Equals(const FormatType& other) const {
}
Clipboard::Clipboard() : clipboard_data_(NULL) {
+ DCHECK(CalledOnValidThread());
clipboard_ = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
primary_selection_ = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
}
Clipboard::~Clipboard() {
+ DCHECK(CalledOnValidThread());
gtk_clipboard_store(clipboard_);
}
void Clipboard::WriteObjects(Buffer buffer, const ObjectMap& objects) {
+ DCHECK(CalledOnValidThread());
clipboard_data_ = new TargetMap();
for (ObjectMap::const_iterator iter = objects.begin();
@@ -233,6 +236,7 @@ void Clipboard::WriteObjects(Buffer buffer, const ObjectMap& objects) {
// location", for example), we additionally stick it in the X clipboard. This
// matches other linux browsers.
void Clipboard::DidWriteURL(const std::string& utf8_text) {
+ DCHECK(CalledOnValidThread());
gtk_clipboard_set_text(primary_selection_, utf8_text.c_str(),
utf8_text.length());
}
@@ -349,6 +353,7 @@ void Clipboard::WriteData(const FormatType& format,
// and does not always refresh the cache when it is appropriate.
bool Clipboard::IsFormatAvailable(const Clipboard::FormatType& format,
Clipboard::Buffer buffer) const {
+ DCHECK(CalledOnValidThread());
GtkClipboard* clipboard = LookupBackingClipboard(buffer);
if (clipboard == NULL)
return false;
@@ -398,6 +403,7 @@ bool Clipboard::IsFormatAvailable(const Clipboard::FormatType& format,
void Clipboard::ReadAvailableTypes(Clipboard::Buffer buffer,
std::vector<string16>* types,
bool* contains_filenames) const {
+ DCHECK(CalledOnValidThread());
if (!types || !contains_filenames) {
NOTREACHED();
return;
@@ -428,6 +434,7 @@ void Clipboard::ReadAvailableTypes(Clipboard::Buffer buffer,
void Clipboard::ReadText(Clipboard::Buffer buffer, string16* result) const {
+ DCHECK(CalledOnValidThread());
GtkClipboard* clipboard = LookupBackingClipboard(buffer);
if (clipboard == NULL)
return;
@@ -445,6 +452,7 @@ void Clipboard::ReadText(Clipboard::Buffer buffer, string16* result) const {
void Clipboard::ReadAsciiText(Clipboard::Buffer buffer,
std::string* result) const {
+ DCHECK(CalledOnValidThread());
GtkClipboard* clipboard = LookupBackingClipboard(buffer);
if (clipboard == NULL)
return;
@@ -464,6 +472,7 @@ void Clipboard::ReadAsciiText(Clipboard::Buffer buffer,
void Clipboard::ReadHTML(Clipboard::Buffer buffer, string16* markup,
std::string* src_url, uint32* fragment_start,
uint32* fragment_end) const {
+ DCHECK(CalledOnValidThread());
markup->clear();
if (src_url)
src_url->clear();
@@ -504,6 +513,7 @@ void Clipboard::ReadHTML(Clipboard::Buffer buffer, string16* markup,
}
SkBitmap Clipboard::ReadImage(Buffer buffer) const {
+ DCHECK(CalledOnValidThread());
ScopedGObject<GdkPixbuf>::Type pixbuf(
gtk_clipboard_wait_for_image(clipboard_));
if (!pixbuf.get())
@@ -524,6 +534,7 @@ SkBitmap Clipboard::ReadImage(Buffer buffer) const {
void Clipboard::ReadCustomData(Buffer buffer,
const string16& type,
string16* result) const {
+ DCHECK(CalledOnValidThread());
GtkClipboard* clipboard = LookupBackingClipboard(buffer);
if (!clipboard)
return;
@@ -544,6 +555,7 @@ void Clipboard::ReadBookmark(string16* title, std::string* url) const {
}
void Clipboard::ReadData(const FormatType& format, std::string* result) const {
+ DCHECK(CalledOnValidThread());
GtkSelectionData* data =
gtk_clipboard_wait_for_contents(clipboard_, format.ToGdkAtom());
if (!data)
@@ -555,6 +567,7 @@ void Clipboard::ReadData(const FormatType& format, std::string* result) const {
}
uint64 Clipboard::GetSequenceNumber(Buffer buffer) {
+ DCHECK(CalledOnValidThread());
if (buffer == BUFFER_STANDARD)
return SelectionChangeObserver::GetInstance()->clipboard_sequence_number();
else
« no previous file with comments | « ui/base/clipboard/clipboard_aurax11.cc ('k') | ui/base/clipboard/clipboard_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698