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

Unified Diff: content/browser/browser_main_loop.cc

Issue 10916214: Try 2 - 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: Moved to BrowserThreadsStarted 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: content/browser/browser_main_loop.cc
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 51552b6fd9868d6d94a1f8127b2a58b3876919f9..851a5cc594fe0ef1a65d7c35b5709f0ce2b213ee 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -46,6 +46,7 @@
#include "net/base/ssl_config_service.h"
#include "net/socket/client_socket_factory.h"
#include "net/socket/tcp_client_socket.h"
+#include "ui/base/clipboard/clipboard.h"
#if defined(USE_AURA)
#include "content/browser/renderer_host/image_transport_factory.h"
@@ -236,6 +237,7 @@ BrowserMainLoop::BrowserMainLoop(const content::MainFunctionParams& parameters)
BrowserMainLoop::~BrowserMainLoop() {
DCHECK_EQ(this, g_current_browser_main_loop);
+ ui::Clipboard::DestroyClipboardForCurrentThread();
g_current_browser_main_loop = NULL;
}
@@ -665,6 +667,18 @@ void BrowserMainLoop::BrowserThreadsStarted() {
#if defined(ENABLE_INPUT_SPEECH)
speech_recognition_manager_.reset(new speech::SpeechRecognitionManagerImpl());
#endif
+
+ // Alert the clipboard class to which threads are allowed to access the
+ // clipboard:
+ std::vector<base::PlatformThreadId> allowed_clipboard_threads;
+ // The current thread is the UI thread.
+ allowed_clipboard_threads.push_back(base::PlatformThread::CurrentId());
+#if defined(OS_WIN)
+ // On Windows, clipboards are also used on the File or IO threads.
+ allowed_clipboard_threads.push_back(file_thread_->thread_id());
+ allowed_clipboard_threads.push_back(io_thread_->thread_id());
+#endif
+ ui::Clipboard::SetAllowedThreads(allowed_clipboard_threads);
}
void BrowserMainLoop::InitializeToolkit() {
« no previous file with comments | « chrome_frame/test/chrome_frame_test_utils.cc ('k') | content/browser/renderer_host/clipboard_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698