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

Unified Diff: include/v8.h

Issue 18707: Split handle scopes into an internal version and a version accessible... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/api.h » ('j') | src/apiutils.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
===================================================================
--- include/v8.h (revision 1129)
+++ include/v8.h (working copy)
@@ -396,19 +396,11 @@
*/
class EXPORT HandleScope {
public:
- HandleScope() : previous_(current_), is_closed_(false) {
- current_.extensions = 0;
- }
+ HandleScope();
- ~HandleScope() {
- // TODO(1245391): In a perfect world, there would be a way of not
- // having to check for explicitly closed scopes maybe through
- // subclassing HandleScope?
- if (!is_closed_) RestorePreviousState();
- }
+ ~HandleScope();
/**
- * TODO(1245391): Consider introducing a subclass for this.
* Closes the handle scope and returns the value as a handle in the
* previous scope, which is the new current scope after the call.
*/
@@ -432,6 +424,8 @@
void* operator new(size_t size);
void operator delete(void*, size_t);
+ // This Data class is accessible internally through a typedef in the
+ // ImplementationUtilities class.
class EXPORT Data {
public:
int extensions;
@@ -443,31 +437,13 @@
}
};
- static Data current_;
- const Data previous_;
+ Data previous_;
- /**
- * Re-establishes the previous scope state. Should be called only
- * once, and only for the current scope.
- */
- void RestorePreviousState() {
- if (current_.extensions > 0) DeleteExtensions();
- current_ = previous_;
-#ifdef DEBUG
- ZapRange(current_.next, current_.limit);
-#endif
- }
-
- // TODO(1245391): Consider creating a subclass for this.
+ // Allow for the active closing of HandleScopes which allows to pass a handle
+ // from the HandleScope being closed to the next top most HandleScope.
bool is_closed_;
void** RawClose(void** value);
- /** Deallocates any extensions used by the current scope.*/
- static void DeleteExtensions();
-
- // Zaps the handles in the half-open interval [start, end).
- static void ZapRange(void** start, void** end);
-
friend class ImplementationUtilities;
};
@@ -2284,10 +2260,17 @@
*/
static bool IsLocked();
+ /**
+ * Returns whether v8::Locker is being used by this V8 instance.
+ */
+ static bool IsActive() { return active_; }
+
private:
bool has_lock_;
bool top_level_;
+ static bool active_;
+
// Disallow copying and assigning.
Locker(const Locker&);
void operator=(const Locker&);
« no previous file with comments | « no previous file | src/api.h » ('j') | src/apiutils.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698