| OLD | NEW |
| 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 "sky/viewer/platform/platform_impl.h" | 5 #include "sky/viewer/platform/platform_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 error.staleCopyInCache = false; | 121 error.staleCopyInCache = false; |
| 122 error.isCancellation = true; | 122 error.isCancellation = true; |
| 123 return error; | 123 return error; |
| 124 } | 124 } |
| 125 | 125 |
| 126 const unsigned char* PlatformImpl::getTraceCategoryEnabledFlag( | 126 const unsigned char* PlatformImpl::getTraceCategoryEnabledFlag( |
| 127 const char* category_group) { | 127 const char* category_group) { |
| 128 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); | 128 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); |
| 129 } | 129 } |
| 130 | 130 |
| 131 long* PlatformImpl::getTraceSamplingState(const unsigned thread_bucket) { | |
| 132 switch (thread_bucket) { | |
| 133 case 0: | |
| 134 return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(0)); | |
| 135 case 1: | |
| 136 return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(1)); | |
| 137 case 2: | |
| 138 return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(2)); | |
| 139 default: | |
| 140 NOTREACHED() << "Unknown thread bucket type."; | |
| 141 } | |
| 142 return NULL; | |
| 143 } | |
| 144 | |
| 145 COMPILE_ASSERT( | 131 COMPILE_ASSERT( |
| 146 sizeof(blink::Platform::TraceEventHandle) == | 132 sizeof(blink::Platform::TraceEventHandle) == |
| 147 sizeof(base::debug::TraceEventHandle), | 133 sizeof(base::debug::TraceEventHandle), |
| 148 TraceEventHandle_types_must_be_same_size); | 134 TraceEventHandle_types_must_be_same_size); |
| 149 | 135 |
| 150 blink::Platform::TraceEventHandle PlatformImpl::addTraceEvent( | 136 blink::Platform::TraceEventHandle PlatformImpl::addTraceEvent( |
| 151 char phase, | 137 char phase, |
| 152 const unsigned char* category_group_enabled, | 138 const unsigned char* category_group_enabled, |
| 153 const char* name, | 139 const char* name, |
| 154 unsigned long long id, | 140 unsigned long long id, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 const unsigned char* category_group_enabled, | 193 const unsigned char* category_group_enabled, |
| 208 const char* name, | 194 const char* name, |
| 209 TraceEventHandle handle) { | 195 TraceEventHandle handle) { |
| 210 base::debug::TraceEventHandle traceEventHandle; | 196 base::debug::TraceEventHandle traceEventHandle; |
| 211 memcpy(&traceEventHandle, &handle, sizeof(handle)); | 197 memcpy(&traceEventHandle, &handle, sizeof(handle)); |
| 212 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( | 198 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( |
| 213 category_group_enabled, name, traceEventHandle); | 199 category_group_enabled, name, traceEventHandle); |
| 214 } | 200 } |
| 215 | 201 |
| 216 } // namespace sky | 202 } // namespace sky |
| OLD | NEW |