OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 <stdio.h> | 5 #include <stdio.h> |
6 #include <string.h> | 6 #include <string.h> |
7 | 7 |
8 #include "include/libplatform/v8-tracing.h" | 8 #include "include/libplatform/v8-tracing.h" |
9 | 9 |
10 #include "src/base/platform/mutex.h" | 10 #include "src/base/platform/mutex.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // to guarantee that metadata events are always added even if the category | 137 // to guarantee that metadata events are always added even if the category |
138 // filter is "-*". See crbug.com/618054 for more details and long-term fix. | 138 // filter is "-*". See crbug.com/618054 for more details and long-term fix. |
139 if (mode_ == RECORDING_MODE && !strcmp(category_group, "__metadata")) { | 139 if (mode_ == RECORDING_MODE && !strcmp(category_group, "__metadata")) { |
140 enabled_flag |= ENABLED_FOR_RECORDING; | 140 enabled_flag |= ENABLED_FOR_RECORDING; |
141 } | 141 } |
142 | 142 |
143 g_category_group_enabled[category_index] = enabled_flag; | 143 g_category_group_enabled[category_index] = enabled_flag; |
144 } | 144 } |
145 | 145 |
146 void TracingController::UpdateCategoryGroupEnabledFlags() { | 146 void TracingController::UpdateCategoryGroupEnabledFlags() { |
147 size_t category_index = base::NoBarrier_Load(&g_category_index); | 147 size_t category_index = base::Relaxed_Load(&g_category_index); |
148 for (size_t i = 0; i < category_index; i++) UpdateCategoryGroupEnabledFlag(i); | 148 for (size_t i = 0; i < category_index; i++) UpdateCategoryGroupEnabledFlag(i); |
149 } | 149 } |
150 | 150 |
151 const uint8_t* TracingController::GetCategoryGroupEnabledInternal( | 151 const uint8_t* TracingController::GetCategoryGroupEnabledInternal( |
152 const char* category_group) { | 152 const char* category_group) { |
153 // Check that category groups does not contain double quote | 153 // Check that category groups does not contain double quote |
154 DCHECK(!strchr(category_group, '"')); | 154 DCHECK(!strchr(category_group, '"')); |
155 | 155 |
156 // The g_category_groups is append only, avoid using a lock for the fast path. | 156 // The g_category_groups is append only, avoid using a lock for the fast path. |
157 size_t current_category_index = v8::base::Acquire_Load(&g_category_index); | 157 size_t current_category_index = v8::base::Acquire_Load(&g_category_index); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 void TracingController::RemoveTraceStateObserver( | 209 void TracingController::RemoveTraceStateObserver( |
210 Platform::TraceStateObserver* observer) { | 210 Platform::TraceStateObserver* observer) { |
211 base::LockGuard<base::Mutex> lock(mutex_.get()); | 211 base::LockGuard<base::Mutex> lock(mutex_.get()); |
212 DCHECK(observers_.find(observer) != observers_.end()); | 212 DCHECK(observers_.find(observer) != observers_.end()); |
213 observers_.erase(observer); | 213 observers_.erase(observer); |
214 } | 214 } |
215 | 215 |
216 } // namespace tracing | 216 } // namespace tracing |
217 } // namespace platform | 217 } // namespace platform |
218 } // namespace v8 | 218 } // namespace v8 |
OLD | NEW |