Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: src/api.cc

Issue 2887193002: Create a thread safe version of StatsCounters and use. (Closed)
Patch Set: Clean up nits. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/counters.h » ('j') | src/counters.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 8696 matching lines...) Expand 10 before | Expand all | Expand 10 after
8707 } 8707 }
8708 8708
8709 8709
8710 void Isolate::SetUseCounterCallback(UseCounterCallback callback) { 8710 void Isolate::SetUseCounterCallback(UseCounterCallback callback) {
8711 reinterpret_cast<i::Isolate*>(this)->SetUseCounterCallback(callback); 8711 reinterpret_cast<i::Isolate*>(this)->SetUseCounterCallback(callback);
8712 } 8712 }
8713 8713
8714 8714
8715 void Isolate::SetCounterFunction(CounterLookupCallback callback) { 8715 void Isolate::SetCounterFunction(CounterLookupCallback callback) {
8716 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 8716 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
8717 isolate->stats_table()->SetCounterFunction(callback); 8717 isolate->stats_table()->SetCounterFunction(callback, isolate);
8718 isolate->InitializeLoggingAndCounters();
8719 isolate->counters()->ResetCounters();
8720 } 8718 }
8721 8719
8722 8720
8723 void Isolate::SetCreateHistogramFunction(CreateHistogramCallback callback) { 8721 void Isolate::SetCreateHistogramFunction(CreateHistogramCallback callback) {
8724 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 8722 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
8725 isolate->stats_table()->SetCreateHistogramFunction(callback); 8723 isolate->stats_table()->SetCreateHistogramFunction(callback);
8726 isolate->InitializeLoggingAndCounters(); 8724 isolate->InitializeLoggingAndCounters();
8727 isolate->counters()->ResetHistograms(); 8725 isolate->counters()->ResetHistograms();
8728 isolate->counters()->InitializeHistograms(); 8726 isolate->counters()->InitializeHistograms();
8729 } 8727 }
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after
10509 Address callback_address = 10507 Address callback_address =
10510 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 10508 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
10511 VMState<EXTERNAL> state(isolate); 10509 VMState<EXTERNAL> state(isolate);
10512 ExternalCallbackScope call_scope(isolate, callback_address); 10510 ExternalCallbackScope call_scope(isolate, callback_address);
10513 callback(info); 10511 callback(info);
10514 } 10512 }
10515 10513
10516 10514
10517 } // namespace internal 10515 } // namespace internal
10518 } // namespace v8 10516 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/counters.h » ('j') | src/counters.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698