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

Side by Side Diff: content/child/blink_platform_impl.cc

Issue 1122153002: Fixit: Fork base::TimeTicks --> TimeTicks + ThreadTicks + TraceTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@FIXIT_timeclasses_1of2
Patch Set: REBASE after it passed CQ but did not commit to tree Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/child/blink_platform_impl.h" 5 #include "content/child/blink_platform_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 char phase, 634 char phase,
635 const unsigned char* category_group_enabled, 635 const unsigned char* category_group_enabled,
636 const char* name, 636 const char* name,
637 unsigned long long id, 637 unsigned long long id,
638 double timestamp, 638 double timestamp,
639 int num_args, 639 int num_args,
640 const char** arg_names, 640 const char** arg_names,
641 const unsigned char* arg_types, 641 const unsigned char* arg_types,
642 const unsigned long long* arg_values, 642 const unsigned long long* arg_values,
643 unsigned char flags) { 643 unsigned char flags) {
644 base::TimeTicks timestamp_tt = base::TimeTicks::FromInternalValue( 644 base::TraceTicks timestamp_tt =
645 static_cast<int64>(timestamp * base::Time::kMicrosecondsPerSecond)); 645 base::TraceTicks() + base::TimeDelta::FromSecondsD(timestamp);
646 base::trace_event::TraceEventHandle handle = 646 base::trace_event::TraceEventHandle handle =
647 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( 647 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(
648 phase, category_group_enabled, name, id, 648 phase, category_group_enabled, name, id,
649 base::PlatformThread::CurrentId(), 649 base::PlatformThread::CurrentId(),
650 timestamp_tt, 650 timestamp_tt,
651 num_args, arg_names, arg_types, arg_values, NULL, flags); 651 num_args, arg_names, arg_types, arg_values, NULL, flags);
652 blink::Platform::TraceEventHandle result; 652 blink::Platform::TraceEventHandle result;
653 memcpy(&result, &handle, sizeof(result)); 653 memcpy(&result, &handle, sizeof(result));
654 return result; 654 return result;
655 } 655 }
(...skipping 15 matching lines...) Expand all
671 if (convertable_values) { 671 if (convertable_values) {
672 size_t size = std::min(static_cast<size_t>(num_args), 672 size_t size = std::min(static_cast<size_t>(num_args),
673 arraysize(convertable_wrappers)); 673 arraysize(convertable_wrappers));
674 for (size_t i = 0; i < size; ++i) { 674 for (size_t i = 0; i < size; ++i) {
675 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) { 675 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) {
676 convertable_wrappers[i] = 676 convertable_wrappers[i] =
677 new ConvertableToTraceFormatWrapper(convertable_values[i]); 677 new ConvertableToTraceFormatWrapper(convertable_values[i]);
678 } 678 }
679 } 679 }
680 } 680 }
681 base::TimeTicks timestamp_tt = base::TimeTicks::FromInternalValue( 681 base::TraceTicks timestamp_tt =
682 static_cast<int64>(timestamp * base::Time::kMicrosecondsPerSecond)); 682 base::TraceTicks() + base::TimeDelta::FromSecondsD(timestamp);
683 base::trace_event::TraceEventHandle handle = 683 base::trace_event::TraceEventHandle handle =
684 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(phase, 684 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(phase,
685 category_group_enabled, 685 category_group_enabled,
686 name, 686 name,
687 id, 687 id,
688 base::PlatformThread::CurrentId(), 688 base::PlatformThread::CurrentId(),
689 timestamp_tt, 689 timestamp_tt,
690 num_args, 690 num_args,
691 arg_names, 691 arg_names,
692 arg_types, 692 arg_types,
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 double BlinkPlatformImpl::currentTime() { 1086 double BlinkPlatformImpl::currentTime() {
1087 return base::Time::Now().ToDoubleT(); 1087 return base::Time::Now().ToDoubleT();
1088 } 1088 }
1089 1089
1090 double BlinkPlatformImpl::monotonicallyIncreasingTime() { 1090 double BlinkPlatformImpl::monotonicallyIncreasingTime() {
1091 return base::TimeTicks::Now().ToInternalValue() / 1091 return base::TimeTicks::Now().ToInternalValue() /
1092 static_cast<double>(base::Time::kMicrosecondsPerSecond); 1092 static_cast<double>(base::Time::kMicrosecondsPerSecond);
1093 } 1093 }
1094 1094
1095 double BlinkPlatformImpl::systemTraceTime() { 1095 double BlinkPlatformImpl::systemTraceTime() {
1096 return base::TimeTicks::NowFromSystemTraceTime().ToInternalValue() / 1096 return (base::TraceTicks::Now() - base::TraceTicks()).InSecondsF();
1097 static_cast<double>(base::Time::kMicrosecondsPerSecond);
1098 } 1097 }
1099 1098
1100 void BlinkPlatformImpl::cryptographicallyRandomValues( 1099 void BlinkPlatformImpl::cryptographicallyRandomValues(
1101 unsigned char* buffer, size_t length) { 1100 unsigned char* buffer, size_t length) {
1102 base::RandBytes(buffer, length); 1101 base::RandBytes(buffer, length);
1103 } 1102 }
1104 1103
1105 void BlinkPlatformImpl::setSharedTimerFiredFunction(void (*func)()) { 1104 void BlinkPlatformImpl::setSharedTimerFiredFunction(void (*func)()) {
1106 shared_timer_func_ = func; 1105 shared_timer_func_ = func;
1107 } 1106 }
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( 1388 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString(
1390 static_cast<ui::DomCode>(dom_code))); 1389 static_cast<ui::DomCode>(dom_code)));
1391 } 1390 }
1392 1391
1393 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { 1392 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) {
1394 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( 1393 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode(
1395 code.utf8().data())); 1394 code.utf8().data()));
1396 } 1395 }
1397 1396
1398 } // namespace content 1397 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/tracing/trace_message_filter.cc ('k') | content/renderer/devtools/v8_sampling_profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698