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

Side by Side Diff: src/api.cc

Issue 1414483004: Add the rate of js invocations from the api as a signal of idleness (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments from Hannes Created 5 years, 1 month 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/heap/memory-reducer.h » ('j') | no next file with comments »
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 class CallDepthScope { 151 class CallDepthScope {
152 public: 152 public:
153 explicit CallDepthScope(i::Isolate* isolate, Local<Context> context, 153 explicit CallDepthScope(i::Isolate* isolate, Local<Context> context,
154 bool do_callback) 154 bool do_callback)
155 : isolate_(isolate), 155 : isolate_(isolate),
156 context_(context), 156 context_(context),
157 escaped_(false), 157 escaped_(false),
158 do_callback_(do_callback) { 158 do_callback_(do_callback) {
159 // TODO(dcarney): remove this when blink stops crashing. 159 // TODO(dcarney): remove this when blink stops crashing.
160 DCHECK(!isolate_->external_caught_exception()); 160 DCHECK(!isolate_->external_caught_exception());
161 isolate_->IncrementJsCallsFromApiCounter();
161 isolate_->handle_scope_implementer()->IncrementCallDepth(); 162 isolate_->handle_scope_implementer()->IncrementCallDepth();
162 if (!context_.IsEmpty()) context_->Enter(); 163 if (!context_.IsEmpty()) context_->Enter();
163 } 164 }
164 ~CallDepthScope() { 165 ~CallDepthScope() {
165 if (!context_.IsEmpty()) context_->Exit(); 166 if (!context_.IsEmpty()) context_->Exit();
166 if (!escaped_) isolate_->handle_scope_implementer()->DecrementCallDepth(); 167 if (!escaped_) isolate_->handle_scope_implementer()->DecrementCallDepth();
167 if (do_callback_) isolate_->FireCallCompletedCallback(); 168 if (do_callback_) isolate_->FireCallCompletedCallback();
168 } 169 }
169 170
170 void Escape() { 171 void Escape() {
(...skipping 8291 matching lines...) Expand 10 before | Expand all | Expand 10 after
8462 Address callback_address = 8463 Address callback_address =
8463 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8464 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8464 VMState<EXTERNAL> state(isolate); 8465 VMState<EXTERNAL> state(isolate);
8465 ExternalCallbackScope call_scope(isolate, callback_address); 8466 ExternalCallbackScope call_scope(isolate, callback_address);
8466 callback(info); 8467 callback(info);
8467 } 8468 }
8468 8469
8469 8470
8470 } // namespace internal 8471 } // namespace internal
8471 } // namespace v8 8472 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/heap/memory-reducer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698