| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/gl/angle_platform_impl.h" | 5 #include "ui/gl/angle_platform_impl.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/metrics/sparse_histogram.h" | 8 #include "base/metrics/sparse_histogram.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 | 10 |
| 11 namespace gfx { | 11 namespace gfx { |
| 12 | 12 |
| 13 ANGLEPlatformImpl::ANGLEPlatformImpl() { | 13 ANGLEPlatformImpl::ANGLEPlatformImpl() { |
| 14 } | 14 } |
| 15 | 15 |
| 16 ANGLEPlatformImpl::~ANGLEPlatformImpl() { | 16 ANGLEPlatformImpl::~ANGLEPlatformImpl() { |
| 17 } | 17 } |
| 18 | 18 |
| 19 double ANGLEPlatformImpl::currentTime() { | 19 double ANGLEPlatformImpl::currentTime() { |
| 20 return base::Time::Now().ToDoubleT(); | 20 return base::Time::Now().ToDoubleT(); |
| 21 } | 21 } |
| 22 | 22 |
| 23 double ANGLEPlatformImpl::monotonicallyIncreasingTime() { | 23 double ANGLEPlatformImpl::monotonicallyIncreasingTime() { |
| 24 return (base::TraceTicks::Now() - base::TraceTicks()).InSecondsF(); | 24 return (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 const unsigned char* ANGLEPlatformImpl::getTraceCategoryEnabledFlag( | 27 const unsigned char* ANGLEPlatformImpl::getTraceCategoryEnabledFlag( |
| 28 const char* category_group) { | 28 const char* category_group) { |
| 29 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); | 29 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void ANGLEPlatformImpl::logError(const char* errorMessage) { | 32 void ANGLEPlatformImpl::logError(const char* errorMessage) { |
| 33 LOG(ERROR) << errorMessage; | 33 LOG(ERROR) << errorMessage; |
| 34 } | 34 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 45 char phase, | 45 char phase, |
| 46 const unsigned char* category_group_enabled, | 46 const unsigned char* category_group_enabled, |
| 47 const char* name, | 47 const char* name, |
| 48 unsigned long long id, | 48 unsigned long long id, |
| 49 double timestamp, | 49 double timestamp, |
| 50 int num_args, | 50 int num_args, |
| 51 const char** arg_names, | 51 const char** arg_names, |
| 52 const unsigned char* arg_types, | 52 const unsigned char* arg_types, |
| 53 const unsigned long long* arg_values, | 53 const unsigned long long* arg_values, |
| 54 unsigned char flags) { | 54 unsigned char flags) { |
| 55 base::TraceTicks timestamp_tt = | 55 base::TimeTicks timestamp_tt = |
| 56 base::TraceTicks() + base::TimeDelta::FromSecondsD(timestamp); | 56 base::TimeTicks() + base::TimeDelta::FromSecondsD(timestamp); |
| 57 base::trace_event::TraceEventHandle handle = | 57 base::trace_event::TraceEventHandle handle = |
| 58 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 58 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 59 phase, category_group_enabled, name, id, trace_event_internal::kNoId, | 59 phase, category_group_enabled, name, id, trace_event_internal::kNoId, |
| 60 base::PlatformThread::CurrentId(), timestamp_tt, num_args, arg_names, | 60 base::PlatformThread::CurrentId(), timestamp_tt, num_args, arg_names, |
| 61 arg_types, arg_values, nullptr, flags); | 61 arg_types, arg_values, nullptr, flags); |
| 62 angle::Platform::TraceEventHandle result; | 62 angle::Platform::TraceEventHandle result; |
| 63 memcpy(&result, &handle, sizeof(result)); | 63 memcpy(&result, &handle, sizeof(result)); |
| 64 return result; | 64 return result; |
| 65 } | 65 } |
| 66 | 66 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // For sparse histograms, we can use the macro, as it does not incorporate a | 104 // For sparse histograms, we can use the macro, as it does not incorporate a |
| 105 // static. | 105 // static. |
| 106 UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample); | 106 UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void ANGLEPlatformImpl::histogramBoolean(const char* name, bool sample) { | 109 void ANGLEPlatformImpl::histogramBoolean(const char* name, bool sample) { |
| 110 histogramEnumeration(name, sample ? 1 : 0, 2); | 110 histogramEnumeration(name, sample ? 1 : 0, 2); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace gfx | 113 } // namespace gfx |
| OLD | NEW |