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

Side by Side Diff: webkit/glue/webkitclient_impl.cc

Issue 7699001: Cleanup: remove ifdefs for USE_MONOTONIC_CLOCK_FOR_TIMER_SCHEDULING. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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
« no previous file with comments | « webkit/glue/webkitclient_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 494
495 void WebKitClientImpl::cryptographicallyRandomValues( 495 void WebKitClientImpl::cryptographicallyRandomValues(
496 unsigned char* buffer, size_t length) { 496 unsigned char* buffer, size_t length) {
497 base::RandBytes(buffer, length); 497 base::RandBytes(buffer, length);
498 } 498 }
499 499
500 void WebKitClientImpl::setSharedTimerFiredFunction(void (*func)()) { 500 void WebKitClientImpl::setSharedTimerFiredFunction(void (*func)()) {
501 shared_timer_func_ = func; 501 shared_timer_func_ = func;
502 } 502 }
503 503
504 #ifndef WEBKIT_USE_MONOTONIC_CLOCK_FOR_TIMER_SCHEDULING
505 void WebKitClientImpl::setSharedTimerFireTime(double fire_time) {
506 setSharedTimerFireInterval(fire_time - currentTime());
507 }
508 #endif
509
510 void WebKitClientImpl::setSharedTimerFireInterval(double interval_seconds) { 504 void WebKitClientImpl::setSharedTimerFireInterval(double interval_seconds) {
511 #ifdef WEBKIT_USE_MONOTONIC_CLOCK_FOR_TIMER_SCHEDULING
512 shared_timer_fire_time_ = interval_seconds + monotonicallyIncreasingTime(); 505 shared_timer_fire_time_ = interval_seconds + monotonicallyIncreasingTime();
513 #else
514 shared_timer_fire_time_ = interval_seconds + currentTime();
515 #endif
516 if (shared_timer_suspended_) 506 if (shared_timer_suspended_)
517 return; 507 return;
518 508
519 // By converting between double and int64 representation, we run the risk 509 // By converting between double and int64 representation, we run the risk
520 // of losing precision due to rounding errors. Performing computations in 510 // of losing precision due to rounding errors. Performing computations in
521 // microseconds reduces this risk somewhat. But there still is the potential 511 // microseconds reduces this risk somewhat. But there still is the potential
522 // of us computing a fire time for the timer that is shorter than what we 512 // of us computing a fire time for the timer that is shorter than what we
523 // need. 513 // need.
524 // As the event loop will check event deadlines prior to actually firing 514 // As the event loop will check event deadlines prior to actually firing
525 // them, there is a risk of needlessly rescheduling events and of 515 // them, there is a risk of needlessly rescheduling events and of
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) 649 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning())
660 #ifdef WEBKIT_USE_MONOTONIC_CLOCK_FOR_TIMER_SCHEDULING 650 #ifdef WEBKIT_USE_MONOTONIC_CLOCK_FOR_TIMER_SCHEDULING
661 setSharedTimerFireInterval( 651 setSharedTimerFireInterval(
662 monotonicallyIncreasingTime() - shared_timer_fire_time_); 652 monotonicallyIncreasingTime() - shared_timer_fire_time_);
663 #else 653 #else
664 setSharedTimerFireTime(shared_timer_fire_time_); 654 setSharedTimerFireTime(shared_timer_fire_time_);
665 #endif 655 #endif
666 } 656 }
667 657
668 } // namespace webkit_glue 658 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/webkitclient_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698