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

Side by Side Diff: src/api.cc

Issue 1406303008: Introduce new API for detecting when the embedder is in foreground/background. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comment 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 | « include/v8.h ('k') | src/heap/heap.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 7349 matching lines...) Expand 10 before | Expand all | Expand 10 after
7360 } 7360 }
7361 } 7361 }
7362 7362
7363 7363
7364 int Isolate::ContextDisposedNotification(bool dependant_context) { 7364 int Isolate::ContextDisposedNotification(bool dependant_context) {
7365 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 7365 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7366 return isolate->heap()->NotifyContextDisposed(dependant_context); 7366 return isolate->heap()->NotifyContextDisposed(dependant_context);
7367 } 7367 }
7368 7368
7369 7369
7370 void Isolate::IsolateInForegroundNotification() {
7371 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7372 return isolate->heap()->SetOptimizeForLatency();
7373 }
7374
7375
7376 void Isolate::IsolateInBackgroundNotification() {
7377 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7378 return isolate->heap()->SetOptimizeForMemoryUsage();
7379 }
7380
7381
7370 void Isolate::SetJitCodeEventHandler(JitCodeEventOptions options, 7382 void Isolate::SetJitCodeEventHandler(JitCodeEventOptions options,
7371 JitCodeEventHandler event_handler) { 7383 JitCodeEventHandler event_handler) {
7372 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 7384 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7373 // Ensure that logging is initialized for our isolate. 7385 // Ensure that logging is initialized for our isolate.
7374 isolate->InitializeLoggingAndCounters(); 7386 isolate->InitializeLoggingAndCounters();
7375 isolate->logger()->SetCodeEventHandler(options, event_handler); 7387 isolate->logger()->SetCodeEventHandler(options, event_handler);
7376 } 7388 }
7377 7389
7378 7390
7379 void Isolate::SetStackLimit(uintptr_t stack_limit) { 7391 void Isolate::SetStackLimit(uintptr_t stack_limit) {
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
8362 Address callback_address = 8374 Address callback_address =
8363 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8375 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8364 VMState<EXTERNAL> state(isolate); 8376 VMState<EXTERNAL> state(isolate);
8365 ExternalCallbackScope call_scope(isolate, callback_address); 8377 ExternalCallbackScope call_scope(isolate, callback_address);
8366 callback(info); 8378 callback(info);
8367 } 8379 }
8368 8380
8369 8381
8370 } // namespace internal 8382 } // namespace internal
8371 } // namespace v8 8383 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698