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

Side by Side Diff: include/v8.h

Issue 1813963002: Add memory pressure notification API (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add tests, address comments Created 4 years, 9 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/api.cc » ('j') | src/api.cc » ('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 /** \mainpage V8 API Reference Guide 5 /** \mainpage V8 API Reference Guide
6 * 6 *
7 * V8 is Google's open source JavaScript engine. 7 * V8 is Google's open source JavaScript engine.
8 * 8 *
9 * This set of documents provides reference material generated from the 9 * This set of documents provides reference material generated from the
10 * V8 header file, include/v8.h. 10 * V8 header file, include/v8.h.
(...skipping 5332 matching lines...) Expand 10 before | Expand all | Expand 10 after
5343 /** 5343 /**
5344 * Interface for iterating through all the persistent handles in the heap. 5344 * Interface for iterating through all the persistent handles in the heap.
5345 */ 5345 */
5346 class V8_EXPORT PersistentHandleVisitor { // NOLINT 5346 class V8_EXPORT PersistentHandleVisitor { // NOLINT
5347 public: 5347 public:
5348 virtual ~PersistentHandleVisitor() {} 5348 virtual ~PersistentHandleVisitor() {}
5349 virtual void VisitPersistentHandle(Persistent<Value>* value, 5349 virtual void VisitPersistentHandle(Persistent<Value>* value,
5350 uint16_t class_id) {} 5350 uint16_t class_id) {}
5351 }; 5351 };
5352 5352
5353 /**
5354 * Memory pressure level for the MemoryPressureNotification.
5355 * kNone hints V8 that there is no memory pressure.
5356 * kModerate hints V8 to speed up incremental garbage collection.
5357 * kCritical hints V8 to free memory as soon as possible.
5358 */
5359 enum class MemoryPressureLevel { kNone, kModerate, kCritical };
5353 5360
5354 /** 5361 /**
5355 * Isolate represents an isolated instance of the V8 engine. V8 isolates have 5362 * Isolate represents an isolated instance of the V8 engine. V8 isolates have
5356 * completely separate states. Objects from one isolate must not be used in 5363 * completely separate states. Objects from one isolate must not be used in
5357 * other isolates. The embedder can create multiple isolates and use them in 5364 * other isolates. The embedder can create multiple isolates and use them in
5358 * parallel in multiple threads. An isolate can be entered by at most one 5365 * parallel in multiple threads. An isolate can be entered by at most one
5359 * thread at any given time. The Locker/Unlocker API must be used to 5366 * thread at any given time. The Locker/Unlocker API must be used to
5360 * synchronize. 5367 * synchronize.
5361 */ 5368 */
5362 class V8_EXPORT Isolate { 5369 class V8_EXPORT Isolate {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
5584 * then V8 will abort if either: 5591 * then V8 will abort if either:
5585 * - no custom callback is set. 5592 * - no custom callback is set.
5586 * - the custom callback set returns true. 5593 * - the custom callback set returns true.
5587 * Otherwise, the custom callback will not be called and V8 will not abort. 5594 * Otherwise, the custom callback will not be called and V8 will not abort.
5588 */ 5595 */
5589 typedef bool (*AbortOnUncaughtExceptionCallback)(Isolate*); 5596 typedef bool (*AbortOnUncaughtExceptionCallback)(Isolate*);
5590 void SetAbortOnUncaughtExceptionCallback( 5597 void SetAbortOnUncaughtExceptionCallback(
5591 AbortOnUncaughtExceptionCallback callback); 5598 AbortOnUncaughtExceptionCallback callback);
5592 5599
5593 /** 5600 /**
5601 * Optional notification that the system is running low on memory.
5602 * V8 uses these notifications to guide heuristics.
5603 * It is allowed to call this function from another thread while
5604 * the isolate is executing long running JavaScript code.
5605 */
5606 void MemoryPressureNotification(MemoryPressureLevel level);
5607
5608 /**
5594 * Methods below this point require holding a lock (using Locker) in 5609 * Methods below this point require holding a lock (using Locker) in
5595 * a multi-threaded environment. 5610 * a multi-threaded environment.
5596 */ 5611 */
5597 5612
5598 /** 5613 /**
5599 * Sets this isolate as the entered one for the current thread. 5614 * Sets this isolate as the entered one for the current thread.
5600 * Saves the previously entered one (if any), so that it can be 5615 * Saves the previously entered one (if any), so that it can be
5601 * restored when exiting. Re-entering an isolate is allowed. 5616 * restored when exiting. Re-entering an isolate is allowed.
5602 */ 5617 */
5603 void Enter(); 5618 void Enter();
(...skipping 3054 matching lines...) Expand 10 before | Expand all | Expand 10 after
8658 */ 8673 */
8659 8674
8660 8675
8661 } // namespace v8 8676 } // namespace v8
8662 8677
8663 8678
8664 #undef TYPE_CHECK 8679 #undef TYPE_CHECK
8665 8680
8666 8681
8667 #endif // INCLUDE_V8_H_ 8682 #endif // INCLUDE_V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698