| 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 |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 // This results in measurable performance degradation unless we use ceil() to | 521 // This results in measurable performance degradation unless we use ceil() to |
| 522 // always round up the sleep times. | 522 // always round up the sleep times. |
| 523 int64 interval = static_cast<int64>( | 523 int64 interval = static_cast<int64>( |
| 524 ceil(interval_seconds * base::Time::kMillisecondsPerSecond) | 524 ceil(interval_seconds * base::Time::kMillisecondsPerSecond) |
| 525 * base::Time::kMicrosecondsPerMillisecond); | 525 * base::Time::kMicrosecondsPerMillisecond); |
| 526 | 526 |
| 527 if (interval < 0) | 527 if (interval < 0) |
| 528 interval = 0; | 528 interval = 0; |
| 529 | 529 |
| 530 shared_timer_.Stop(); | 530 shared_timer_.Stop(); |
| 531 shared_timer_.Start(base::TimeDelta::FromMicroseconds(interval), this, | 531 shared_timer_.Start(FROM_HERE, base::TimeDelta::FromMicroseconds(interval), |
| 532 &WebKitPlatformSupportImpl::DoTimeout); | 532 this, &WebKitPlatformSupportImpl::DoTimeout); |
| 533 } | 533 } |
| 534 | 534 |
| 535 void WebKitPlatformSupportImpl::stopSharedTimer() { | 535 void WebKitPlatformSupportImpl::stopSharedTimer() { |
| 536 shared_timer_.Stop(); | 536 shared_timer_.Stop(); |
| 537 } | 537 } |
| 538 | 538 |
| 539 void WebKitPlatformSupportImpl::callOnMainThread( | 539 void WebKitPlatformSupportImpl::callOnMainThread( |
| 540 void (*func)(void*), void* context) { | 540 void (*func)(void*), void* context) { |
| 541 main_loop_->PostTask(FROM_HERE, NewRunnableFunction(func, context)); | 541 main_loop_->PostTask(FROM_HERE, NewRunnableFunction(func, context)); |
| 542 } | 542 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 | 651 |
| 652 void WebKitPlatformSupportImpl::ResumeSharedTimer() { | 652 void WebKitPlatformSupportImpl::ResumeSharedTimer() { |
| 653 // The shared timer may have fired or been adjusted while we were suspended. | 653 // The shared timer may have fired or been adjusted while we were suspended. |
| 654 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) { | 654 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) { |
| 655 setSharedTimerFireInterval( | 655 setSharedTimerFireInterval( |
| 656 monotonicallyIncreasingTime() - shared_timer_fire_time_); | 656 monotonicallyIncreasingTime() - shared_timer_fire_time_); |
| 657 } | 657 } |
| 658 } | 658 } |
| 659 | 659 |
| 660 } // namespace webkit_glue | 660 } // namespace webkit_glue |
| OLD | NEW |