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 |