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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 return ReplaceStringPlaceholders( | 444 return ReplaceStringPlaceholders( |
445 GetLocalizedString(message_id), values, NULL); | 445 GetLocalizedString(message_id), values, NULL); |
446 } | 446 } |
447 | 447 |
448 double WebKitClientImpl::currentTime() { | 448 double WebKitClientImpl::currentTime() { |
449 return base::Time::Now().ToDoubleT(); | 449 return base::Time::Now().ToDoubleT(); |
450 } | 450 } |
451 | 451 |
452 void WebKitClientImpl::cryptographicallyRandomValues( | 452 void WebKitClientImpl::cryptographicallyRandomValues( |
453 unsigned char* buffer, size_t length) { | 453 unsigned char* buffer, size_t length) { |
454 uint64 bytes = 0; | 454 base::RandBytes(buffer, length); |
455 for (size_t i = 0; i < length; ++i) { | |
456 size_t offset = i % sizeof(bytes); | |
457 if (!offset) | |
458 bytes = base::RandUint64(); | |
459 buffer[i] = reinterpret_cast<unsigned char*>(&bytes)[offset]; | |
460 } | |
461 } | 455 } |
462 | 456 |
463 void WebKitClientImpl::setSharedTimerFiredFunction(void (*func)()) { | 457 void WebKitClientImpl::setSharedTimerFiredFunction(void (*func)()) { |
464 shared_timer_func_ = func; | 458 shared_timer_func_ = func; |
465 } | 459 } |
466 | 460 |
467 void WebKitClientImpl::setSharedTimerFireTime(double fire_time) { | 461 void WebKitClientImpl::setSharedTimerFireTime(double fire_time) { |
468 shared_timer_fire_time_ = fire_time; | 462 shared_timer_fire_time_ = fire_time; |
469 if (shared_timer_suspended_) | 463 if (shared_timer_suspended_) |
470 return; | 464 return; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 ++shared_timer_suspended_; | 590 ++shared_timer_suspended_; |
597 } | 591 } |
598 | 592 |
599 void WebKitClientImpl::ResumeSharedTimer() { | 593 void WebKitClientImpl::ResumeSharedTimer() { |
600 // The shared timer may have fired or been adjusted while we were suspended. | 594 // The shared timer may have fired or been adjusted while we were suspended. |
601 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) | 595 if (--shared_timer_suspended_ == 0 && !shared_timer_.IsRunning()) |
602 setSharedTimerFireTime(shared_timer_fire_time_); | 596 setSharedTimerFireTime(shared_timer_fire_time_); |
603 } | 597 } |
604 | 598 |
605 } // namespace webkit_glue | 599 } // namespace webkit_glue |
OLD | NEW |