| 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 } |
| 35 | 35 |
| 36 void ANGLEPlatformImpl::logWarning(const char* warningMessage) { | 36 void ANGLEPlatformImpl::logWarning(const char* warningMessage) { |
| 37 LOG(WARNING) << warningMessage; | 37 LOG(WARNING) << warningMessage; |
| 38 } | 38 } |
| 39 | 39 |
| 40 angle::Platform::TraceEventHandle ANGLEPlatformImpl::addTraceEvent( | 40 angle::Platform::TraceEventHandle ANGLEPlatformImpl::addTraceEvent( |
| 41 char phase, | 41 char phase, |
| 42 const unsigned char* category_group_enabled, | 42 const unsigned char* category_group_enabled, |
| 43 const char* name, | 43 const char* name, |
| 44 unsigned long long id, | 44 unsigned long long id, |
| 45 double timestamp, | 45 double timestamp, |
| 46 int num_args, | 46 int num_args, |
| 47 const char** arg_names, | 47 const char** arg_names, |
| 48 const unsigned char* arg_types, | 48 const unsigned char* arg_types, |
| 49 const unsigned long long* arg_values, | 49 const unsigned long long* arg_values, |
| 50 unsigned char flags) { | 50 unsigned char flags) { |
| 51 base::TraceTicks timestamp_tt = | 51 base::TimeTicks timestamp_tt = |
| 52 base::TraceTicks() + base::TimeDelta::FromSecondsD(timestamp); | 52 base::TimeTicks() + base::TimeDelta::FromSecondsD(timestamp); |
| 53 base::trace_event::TraceEventHandle handle = | 53 base::trace_event::TraceEventHandle handle = |
| 54 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 54 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 55 phase, category_group_enabled, name, id, trace_event_internal::kNoId, | 55 phase, category_group_enabled, name, id, trace_event_internal::kNoId, |
| 56 base::PlatformThread::CurrentId(), timestamp_tt, num_args, arg_names, | 56 base::PlatformThread::CurrentId(), timestamp_tt, num_args, arg_names, |
| 57 arg_types, arg_values, nullptr, flags); | 57 arg_types, arg_values, nullptr, flags); |
| 58 angle::Platform::TraceEventHandle result; | 58 angle::Platform::TraceEventHandle result; |
| 59 memcpy(&result, &handle, sizeof(result)); | 59 memcpy(&result, &handle, sizeof(result)); |
| 60 return result; | 60 return result; |
| 61 } | 61 } |
| 62 | 62 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // For sparse histograms, we can use the macro, as it does not incorporate a | 100 // For sparse histograms, we can use the macro, as it does not incorporate a |
| 101 // static. | 101 // static. |
| 102 UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample); | 102 UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void ANGLEPlatformImpl::histogramBoolean(const char* name, bool sample) { | 105 void ANGLEPlatformImpl::histogramBoolean(const char* name, bool sample) { |
| 106 histogramEnumeration(name, sample ? 1 : 0, 2); | 106 histogramEnumeration(name, sample ? 1 : 0, 2); |
| 107 } | 107 } |
| 108 | 108 |
| 109 } // namespace gfx | 109 } // namespace gfx |
| OLD | NEW |