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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/glue/webkitplatformsupport_impl.h" 5 #include "webkit/glue/webkitplatformsupport_impl.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <malloc.h> 8 #include <malloc.h>
9 #endif 9 #endif
10 10
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 default: 203 default:
204 break; 204 break;
205 } 205 }
206 return -1; 206 return -1;
207 } 207 }
208 208
209 WebKitPlatformSupportImpl::WebKitPlatformSupportImpl() 209 WebKitPlatformSupportImpl::WebKitPlatformSupportImpl()
210 : main_loop_(MessageLoop::current()), 210 : main_loop_(MessageLoop::current()),
211 shared_timer_func_(NULL), 211 shared_timer_func_(NULL),
212 shared_timer_fire_time_(0.0), 212 shared_timer_fire_time_(0.0),
213 shared_timer_suspended_(0) { 213 shared_timer_suspended_(0),
214 current_thread_slot_(&DestroyCurrentThread) {
214 } 215 }
215 216
216 WebKitPlatformSupportImpl::~WebKitPlatformSupportImpl() { 217 WebKitPlatformSupportImpl::~WebKitPlatformSupportImpl() {
217 } 218 }
218 219
219 WebThemeEngine* WebKitPlatformSupportImpl::themeEngine() { 220 WebThemeEngine* WebKitPlatformSupportImpl::themeEngine() {
220 return &theme_engine_; 221 return &theme_engine_;
221 } 222 }
222 223
223 WebURLLoader* WebKitPlatformSupportImpl::createURLLoader() { 224 WebURLLoader* WebKitPlatformSupportImpl::createURLLoader() {
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 539
539 void WebKitPlatformSupportImpl::callOnMainThread( 540 void WebKitPlatformSupportImpl::callOnMainThread(
540 void (*func)(void*), void* context) { 541 void (*func)(void*), void* context) {
541 main_loop_->PostTask(FROM_HERE, NewRunnableFunction(func, context)); 542 main_loop_->PostTask(FROM_HERE, NewRunnableFunction(func, context));
542 } 543 }
543 544
544 WebKit::WebThread* WebKitPlatformSupportImpl::createThread(const char* name) { 545 WebKit::WebThread* WebKitPlatformSupportImpl::createThread(const char* name) {
545 return new WebThreadImpl(name); 546 return new WebThreadImpl(name);
546 } 547 }
547 548
549 WebKit::WebThread* WebKitPlatformSupportImpl::currentThread() {
550 WebThreadImplForMessageLoop* thread =
551 static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get());
552 if (thread)
553 return (thread);
554
555 scoped_refptr<base::MessageLoopProxy> message_loop =
556 base::MessageLoopProxy::current();
557 if (!message_loop)
558 return NULL;
559
560 thread = new WebThreadImplForMessageLoop(message_loop);
561 current_thread_slot_.Set(thread);
562 return thread;
563 }
564
548 base::PlatformFile WebKitPlatformSupportImpl::databaseOpenFile( 565 base::PlatformFile WebKitPlatformSupportImpl::databaseOpenFile(
549 const WebKit::WebString& vfs_file_name, int desired_flags) { 566 const WebKit::WebString& vfs_file_name, int desired_flags) {
550 return base::kInvalidPlatformFileValue; 567 return base::kInvalidPlatformFileValue;
551 } 568 }
552 569
553 int WebKitPlatformSupportImpl::databaseDeleteFile( 570 int WebKitPlatformSupportImpl::databaseDeleteFile(
554 const WebKit::WebString& vfs_file_name, bool sync_dir) { 571 const WebKit::WebString& vfs_file_name, bool sync_dir) {
555 return -1; 572 return -1;
556 } 573 }
557 574
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 } 667 }
651 668
652 void WebKitPlatformSupportImpl::ResumeSharedTimer() { 669 void WebKitPlatformSupportImpl::ResumeSharedTimer() {
653 // The shared timer may have fired or been adjusted while we were suspended. 670 // The shared timer may have fired or been adjusted while we were suspended.
654 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) { 671 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) {
655 setSharedTimerFireInterval( 672 setSharedTimerFireInterval(
656 monotonicallyIncreasingTime() - shared_timer_fire_time_); 673 monotonicallyIncreasingTime() - shared_timer_fire_time_);
657 } 674 }
658 } 675 }
659 676
677 // static
678 void WebKitPlatformSupportImpl::DestroyCurrentThread(void* thread) {
679 WebThreadImplForMessageLoop* impl =
680 static_cast<WebThreadImplForMessageLoop*>(thread);
681 delete impl;
682 }
683
660 } // namespace webkit_glue 684 } // namespace webkit_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698