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

Unified Diff: webkit/glue/webkitplatformsupport_impl.cc

Issue 8228025: Implement WebKitPlatformSupport::currentThread (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: git try Created 9 years, 2 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: webkit/glue/webkitplatformsupport_impl.cc
diff --git a/webkit/glue/webkitplatformsupport_impl.cc b/webkit/glue/webkitplatformsupport_impl.cc
index 8d2941c1490d4ead1112973dee6756270bb8b209..bfa6ec04f871c0d6ad6772dece793af15261d94c 100644
--- a/webkit/glue/webkitplatformsupport_impl.cc
+++ b/webkit/glue/webkitplatformsupport_impl.cc
@@ -210,7 +210,8 @@ WebKitPlatformSupportImpl::WebKitPlatformSupportImpl()
: main_loop_(MessageLoop::current()),
shared_timer_func_(NULL),
shared_timer_fire_time_(0.0),
- shared_timer_suspended_(0) {
+ shared_timer_suspended_(0),
+ current_thread_slot_(&DestroyCurrentThread) {
}
WebKitPlatformSupportImpl::~WebKitPlatformSupportImpl() {
@@ -545,6 +546,22 @@ WebKit::WebThread* WebKitPlatformSupportImpl::createThread(const char* name) {
return new WebThreadImpl(name);
}
+WebKit::WebThread* WebKitPlatformSupportImpl::currentThread() {
+ WebThreadImplForMessageLoop* thread =
+ static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get());
+ if (thread)
+ return (thread);
+
+ scoped_refptr<base::MessageLoopProxy> message_loop =
+ base::MessageLoopProxy::current();
+ if (!message_loop)
+ return NULL;
+
+ thread = new WebThreadImplForMessageLoop(message_loop);
+ current_thread_slot_.Set(thread);
+ return thread;
+}
+
base::PlatformFile WebKitPlatformSupportImpl::databaseOpenFile(
const WebKit::WebString& vfs_file_name, int desired_flags) {
return base::kInvalidPlatformFileValue;
@@ -657,4 +674,11 @@ void WebKitPlatformSupportImpl::ResumeSharedTimer() {
}
}
+// static
+void WebKitPlatformSupportImpl::DestroyCurrentThread(void* thread) {
+ WebThreadImplForMessageLoop* impl =
+ static_cast<WebThreadImplForMessageLoop*>(thread);
+ delete impl;
+}
+
} // namespace webkit_glue

Powered by Google App Engine
This is Rietveld 408576698