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