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

Side by Side Diff: src/api.cc

Issue 2887193002: Create a thread safe version of StatsCounters and use. (Closed)
Patch Set: fix nits of mtrofin Created 3 years, 6 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 8672 matching lines...) Expand 10 before | Expand all | Expand 10 after
8683 } 8683 }
8684 8684
8685 8685
8686 void Isolate::SetUseCounterCallback(UseCounterCallback callback) { 8686 void Isolate::SetUseCounterCallback(UseCounterCallback callback) {
8687 reinterpret_cast<i::Isolate*>(this)->SetUseCounterCallback(callback); 8687 reinterpret_cast<i::Isolate*>(this)->SetUseCounterCallback(callback);
8688 } 8688 }
8689 8689
8690 8690
8691 void Isolate::SetCounterFunction(CounterLookupCallback callback) { 8691 void Isolate::SetCounterFunction(CounterLookupCallback callback) {
8692 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 8692 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
8693 isolate->stats_table()->SetCounterFunction(callback); 8693 isolate->stats_table()->SetCounterFunction(callback, isolate);
8694 isolate->InitializeLoggingAndCounters();
8695 isolate->counters()->ResetCounters();
8696 } 8694 }
8697 8695
8698 8696
8699 void Isolate::SetCreateHistogramFunction(CreateHistogramCallback callback) { 8697 void Isolate::SetCreateHistogramFunction(CreateHistogramCallback callback) {
8700 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 8698 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
8701 isolate->stats_table()->SetCreateHistogramFunction(callback); 8699 isolate->stats_table()->SetCreateHistogramFunction(callback);
8702 isolate->InitializeLoggingAndCounters(); 8700 isolate->InitializeLoggingAndCounters();
8703 isolate->counters()->ResetHistograms(); 8701 isolate->counters()->ResetHistograms();
8704 isolate->counters()->InitializeHistograms(); 8702 isolate->counters()->InitializeHistograms();
8705 } 8703 }
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after
10485 Address callback_address = 10483 Address callback_address =
10486 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 10484 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
10487 VMState<EXTERNAL> state(isolate); 10485 VMState<EXTERNAL> state(isolate);
10488 ExternalCallbackScope call_scope(isolate, callback_address); 10486 ExternalCallbackScope call_scope(isolate, callback_address);
10489 callback(info); 10487 callback(info);
10490 } 10488 }
10491 10489
10492 10490
10493 } // namespace internal 10491 } // namespace internal
10494 } // namespace v8 10492 } // 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