| OLD | NEW |
| 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 |
| 11 #include <math.h> | 11 #include <math.h> |
| 12 | 12 |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/bind.h" |
| 15 #include "base/debug/trace_event.h" | 16 #include "base/debug/trace_event.h" |
| 16 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
| 17 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
| 18 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
| 19 #include "base/metrics/stats_counters.h" | 20 #include "base/metrics/stats_counters.h" |
| 20 #include "base/platform_file.h" | 21 #include "base/platform_file.h" |
| 21 #include "base/process_util.h" | 22 #include "base/process_util.h" |
| 22 #include "base/rand_util.h" | 23 #include "base/rand_util.h" |
| 23 #include "base/string_number_conversions.h" | 24 #include "base/string_number_conversions.h" |
| 24 #include "base/string_util.h" | 25 #include "base/string_util.h" |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 shared_timer_.Start(FROM_HERE, base::TimeDelta::FromMicroseconds(interval), | 537 shared_timer_.Start(FROM_HERE, base::TimeDelta::FromMicroseconds(interval), |
| 537 this, &WebKitPlatformSupportImpl::DoTimeout); | 538 this, &WebKitPlatformSupportImpl::DoTimeout); |
| 538 } | 539 } |
| 539 | 540 |
| 540 void WebKitPlatformSupportImpl::stopSharedTimer() { | 541 void WebKitPlatformSupportImpl::stopSharedTimer() { |
| 541 shared_timer_.Stop(); | 542 shared_timer_.Stop(); |
| 542 } | 543 } |
| 543 | 544 |
| 544 void WebKitPlatformSupportImpl::callOnMainThread( | 545 void WebKitPlatformSupportImpl::callOnMainThread( |
| 545 void (*func)(void*), void* context) { | 546 void (*func)(void*), void* context) { |
| 546 main_loop_->PostTask(FROM_HERE, NewRunnableFunction(func, context)); | 547 main_loop_->PostTask(FROM_HERE, base::Bind(func, context)); |
| 547 } | 548 } |
| 548 | 549 |
| 549 WebKit::WebThread* WebKitPlatformSupportImpl::createThread(const char* name) { | 550 WebKit::WebThread* WebKitPlatformSupportImpl::createThread(const char* name) { |
| 550 return new WebThreadImpl(name); | 551 return new WebThreadImpl(name); |
| 551 } | 552 } |
| 552 | 553 |
| 553 WebKit::WebThread* WebKitPlatformSupportImpl::currentThread() { | 554 WebKit::WebThread* WebKitPlatformSupportImpl::currentThread() { |
| 554 WebThreadImplForMessageLoop* thread = | 555 WebThreadImplForMessageLoop* thread = |
| 555 static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get()); | 556 static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get()); |
| 556 if (thread) | 557 if (thread) |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 } | 679 } |
| 679 | 680 |
| 680 // static | 681 // static |
| 681 void WebKitPlatformSupportImpl::DestroyCurrentThread(void* thread) { | 682 void WebKitPlatformSupportImpl::DestroyCurrentThread(void* thread) { |
| 682 WebThreadImplForMessageLoop* impl = | 683 WebThreadImplForMessageLoop* impl = |
| 683 static_cast<WebThreadImplForMessageLoop*>(thread); | 684 static_cast<WebThreadImplForMessageLoop*>(thread); |
| 684 delete impl; | 685 delete impl; |
| 685 } | 686 } |
| 686 | 687 |
| 687 } // namespace webkit_glue | 688 } // namespace webkit_glue |
| OLD | NEW |