| 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 "src/profiler/profiler-listener.h" | 5 #include "src/profiler/profiler-listener.h" |
| 6 | 6 |
| 7 #include "src/deoptimizer.h" | 7 #include "src/deoptimizer.h" |
| 8 #include "src/profiler/cpu-profiler.h" | 8 #include "src/profiler/cpu-profiler.h" |
| 9 #include "src/profiler/profile-generator-inl.h" | 9 #include "src/profiler/profile-generator-inl.h" |
| 10 #include "src/source-position-table.h" | 10 #include "src/source-position-table.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 const char* name_prefix, const char* resource_name, int line_number, | 312 const char* name_prefix, const char* resource_name, int line_number, |
| 313 int column_number, JITLineInfoTable* line_info, Address instruction_start) { | 313 int column_number, JITLineInfoTable* line_info, Address instruction_start) { |
| 314 CodeEntry* code_entry = | 314 CodeEntry* code_entry = |
| 315 new CodeEntry(tag, name, name_prefix, resource_name, line_number, | 315 new CodeEntry(tag, name, name_prefix, resource_name, line_number, |
| 316 column_number, line_info, instruction_start); | 316 column_number, line_info, instruction_start); |
| 317 code_entries_.push_back(code_entry); | 317 code_entries_.push_back(code_entry); |
| 318 return code_entry; | 318 return code_entry; |
| 319 } | 319 } |
| 320 | 320 |
| 321 void ProfilerListener::AddObserver(CodeEventObserver* observer) { | 321 void ProfilerListener::AddObserver(CodeEventObserver* observer) { |
| 322 base::LockGuard<base::Mutex> guard(&mutex_); |
| 322 if (std::find(observers_.begin(), observers_.end(), observer) != | 323 if (std::find(observers_.begin(), observers_.end(), observer) != |
| 323 observers_.end()) | 324 observers_.end()) |
| 324 return; | 325 return; |
| 325 observers_.push_back(observer); | 326 observers_.push_back(observer); |
| 326 } | 327 } |
| 327 | 328 |
| 328 void ProfilerListener::RemoveObserver(CodeEventObserver* observer) { | 329 void ProfilerListener::RemoveObserver(CodeEventObserver* observer) { |
| 330 base::LockGuard<base::Mutex> guard(&mutex_); |
| 329 auto it = std::find(observers_.begin(), observers_.end(), observer); | 331 auto it = std::find(observers_.begin(), observers_.end(), observer); |
| 330 if (it == observers_.end()) return; | 332 if (it == observers_.end()) return; |
| 331 observers_.erase(it); | 333 observers_.erase(it); |
| 332 } | 334 } |
| 333 | 335 |
| 334 } // namespace internal | 336 } // namespace internal |
| 335 } // namespace v8 | 337 } // namespace v8 |
| OLD | NEW |