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

Side by Side Diff: include/v8.h

Issue 102063004: Introduce API to temporarily interrupt long running JavaScript code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/api.cc » ('j') | test/cctest/test-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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4099 matching lines...) Expand 10 before | Expand all | Expand 10 after
4110 4110
4111 enum GCCallbackFlags { 4111 enum GCCallbackFlags {
4112 kNoGCCallbackFlags = 0, 4112 kNoGCCallbackFlags = 0,
4113 kGCCallbackFlagCompacted = 1 << 0, 4113 kGCCallbackFlagCompacted = 1 << 0,
4114 kGCCallbackFlagConstructRetainedObjectInfos = 1 << 1 4114 kGCCallbackFlagConstructRetainedObjectInfos = 1 << 1
4115 }; 4115 };
4116 4116
4117 typedef void (*GCPrologueCallback)(GCType type, GCCallbackFlags flags); 4117 typedef void (*GCPrologueCallback)(GCType type, GCCallbackFlags flags);
4118 typedef void (*GCEpilogueCallback)(GCType type, GCCallbackFlags flags); 4118 typedef void (*GCEpilogueCallback)(GCType type, GCCallbackFlags flags);
4119 4119
4120 typedef void (*InterruptCallback)(Isolate* isolate, void* data);
4121
4120 4122
4121 /** 4123 /**
4122 * Collection of V8 heap information. 4124 * Collection of V8 heap information.
4123 * 4125 *
4124 * Instances of this class can be passed to v8::V8::HeapStatistics to 4126 * Instances of this class can be passed to v8::V8::HeapStatistics to
4125 * get heap statistics from V8. 4127 * get heap statistics from V8.
4126 */ 4128 */
4127 class V8_EXPORT HeapStatistics { 4129 class V8_EXPORT HeapStatistics {
4128 public: 4130 public:
4129 HeapStatistics(); 4131 HeapStatistics();
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
4370 */ 4372 */
4371 void AddGCEpilogueCallback( 4373 void AddGCEpilogueCallback(
4372 GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll); 4374 GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll);
4373 4375
4374 /** 4376 /**
4375 * This function removes callback which was installed by 4377 * This function removes callback which was installed by
4376 * AddGCEpilogueCallback function. 4378 * AddGCEpilogueCallback function.
4377 */ 4379 */
4378 void RemoveGCEpilogueCallback(GCEpilogueCallback callback); 4380 void RemoveGCEpilogueCallback(GCEpilogueCallback callback);
4379 4381
4382 /**
4383 * Request V8 to interrupt long running JavaScript code and invoke
4384 * the given |callback| passing the given |data| to it. After |callback|
4385 * returns control will be returned to the JavaScript code.
4386 * At any given moment V8 can remember only a single callback for the very
4387 * last interrupt request.
4388 * Can be called from another thread without acquiring a |Locker|.
4389 * Registered |callback| must not reenter interrupted Isolate.
4390 */
4391 void RequestInterrupt(InterruptCallback callback, void* data);
4392
4393 /**
4394 * Clear interrupt request created by |RequestInterrupt|.
4395 * Can be called from another thread without acquiring a |Locker|.
4396 */
4397 void ClearInterrupt();
4398
4380 private: 4399 private:
4381 Isolate(); 4400 Isolate();
4382 Isolate(const Isolate&); 4401 Isolate(const Isolate&);
4383 ~Isolate(); 4402 ~Isolate();
4384 Isolate& operator=(const Isolate&); 4403 Isolate& operator=(const Isolate&);
4385 void* operator new(size_t size); 4404 void* operator new(size_t size);
4386 void operator delete(void*, size_t); 4405 void operator delete(void*, size_t);
4387 4406
4388 void SetObjectGroupId(internal::Object** object, UniqueId id); 4407 void SetObjectGroupId(internal::Object** object, UniqueId id);
4389 void SetReferenceFromGroup(UniqueId id, internal::Object** object); 4408 void SetReferenceFromGroup(UniqueId id, internal::Object** object);
(...skipping 2369 matching lines...) Expand 10 before | Expand all | Expand 10 after
6759 */ 6778 */
6760 6779
6761 6780
6762 } // namespace v8 6781 } // namespace v8
6763 6782
6764 6783
6765 #undef TYPE_CHECK 6784 #undef TYPE_CHECK
6766 6785
6767 6786
6768 #endif // V8_H_ 6787 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | test/cctest/test-api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698