From: jochen Date: Mon, 6 Jul 2015 07:09:07 +0000 (-0700) Subject: Make v8::Handle as "deprecated soon" X-Git-Tag: upstream/4.7.83~1567 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f022e53b9579457d53ee59b46ce6a959d27669a4;p=platform%2Fupstream%2Fv8.git Make v8::Handle as "deprecated soon" BUG=v8:4131 R=bmeurer@chromium.org LOG=n Review URL: https://codereview.chromium.org/1224623004 Cr-Commit-Position: refs/heads/master@{#29473} --- diff --git a/include/v8-debug.h b/include/v8-debug.h index fad2b5880..8071fb34b 100644 --- a/include/v8-debug.h +++ b/include/v8-debug.h @@ -60,20 +60,20 @@ class V8_EXPORT Debug { * callbacks as their content becomes invalid. These objects are from the * debugger event that started the debug message loop. */ - virtual Handle GetExecutionState() const = 0; - virtual Handle GetEventData() const = 0; + virtual Local GetExecutionState() const = 0; + virtual Local GetEventData() const = 0; /** * Get the debugger protocol JSON. */ - virtual Handle GetJSON() const = 0; + virtual Local GetJSON() const = 0; /** * Get the context active when the debug event happened. Note this is not * the current active context as the JavaScript part of the debugger is * running in its own context which is entered at this point. */ - virtual Handle GetEventContext() const = 0; + virtual Local GetEventContext() const = 0; /** * Client data passed with the corresponding request if any. This is the @@ -104,21 +104,21 @@ class V8_EXPORT Debug { * Access to execution state and event data of the debug event. Don't store * these cross callbacks as their content becomes invalid. */ - virtual Handle GetExecutionState() const = 0; - virtual Handle GetEventData() const = 0; + virtual Local GetExecutionState() const = 0; + virtual Local GetEventData() const = 0; /** * Get the context active when the debug event happened. Note this is not * the current active context as the JavaScript part of the debugger is * running in its own context which is entered at this point. */ - virtual Handle GetEventContext() const = 0; + virtual Local GetEventContext() const = 0; /** * Client data passed with the corresponding callback when it was * registered. */ - virtual Handle GetCallbackData() const = 0; + virtual Local GetCallbackData() const = 0; /** * Client data passed to DebugBreakForCommand function. The @@ -156,7 +156,7 @@ class V8_EXPORT Debug { typedef void (*DebugMessageDispatchHandler)(); static bool SetDebugEventListener(EventCallback that, - Handle data = Handle()); + Local data = Local()); // Schedule a debugger break to happen when JavaScript code is run // in the given isolate. @@ -196,20 +196,20 @@ class V8_EXPORT Debug { */ static V8_DEPRECATE_SOON( "Use maybe version", - Local Call(v8::Handle fun, - Handle data = Handle())); + Local Call(v8::Local fun, + Local data = Local())); // TODO(dcarney): data arg should be a MaybeLocal static MaybeLocal Call(Local context, - v8::Handle fun, - Handle data = Handle()); + v8::Local fun, + Local data = Local()); /** * Returns a mirror object for the given object. */ static V8_DEPRECATE_SOON("Use maybe version", - Local GetMirror(v8::Handle obj)); + Local GetMirror(v8::Local obj)); static MaybeLocal GetMirror(Local context, - v8::Handle obj); + v8::Local obj); /** * Makes V8 process all pending debug messages. diff --git a/include/v8-profiler.h b/include/v8-profiler.h index d0375a79e..121e8030a 100644 --- a/include/v8-profiler.h +++ b/include/v8-profiler.h @@ -60,13 +60,13 @@ class V8_EXPORT CpuProfileNode { }; /** Returns function name (empty string for anonymous functions.) */ - Handle GetFunctionName() const; + Local GetFunctionName() const; /** Returns id of the script where function is located. */ int GetScriptId() const; /** Returns resource name for script from where the function originates. */ - Handle GetScriptResourceName() const; + Local GetScriptResourceName() const; /** * Returns the number, 1-based, of the line where the function originates. @@ -129,7 +129,7 @@ class V8_EXPORT CpuProfileNode { class V8_EXPORT CpuProfile { public: /** Returns CPU profile title. */ - Handle GetTitle() const; + Local GetTitle() const; /** Returns the root node of the top down call tree. */ const CpuProfileNode* GetTopDownRoot() const; @@ -198,13 +198,13 @@ class V8_EXPORT CpuProfiler { * |record_samples| parameter controls whether individual samples should * be recorded in addition to the aggregated tree. */ - void StartProfiling(Handle title, bool record_samples = false); + void StartProfiling(Local title, bool record_samples = false); /** * Stops collecting CPU profile with a given title and returns it. * If the title given is empty, finishes the last profile started. */ - CpuProfile* StopProfiling(Handle title); + CpuProfile* StopProfiling(Local title); /** * Tells the profiler whether the embedder is idle. @@ -246,7 +246,7 @@ class V8_EXPORT HeapGraphEdge { * Returns edge name. This can be a variable name, an element index, or * a property name. */ - Handle GetName() const; + Local GetName() const; /** Returns origin node. */ const HeapGraphNode* GetFromNode() const; @@ -287,7 +287,7 @@ class V8_EXPORT HeapGraphNode { * of the constructor (for objects), the name of the function (for * closures), string value, or an empty string (for compiled code). */ - Handle GetName() const; + Local GetName() const; /** * Returns node id. For the same heap object, the id remains the same @@ -430,8 +430,8 @@ class V8_EXPORT HeapProfiler { * while the callback is running: only getters on the handle and * GetPointerFromInternalField on the objects are allowed. */ - typedef RetainedObjectInfo* (*WrapperInfoCallback) - (uint16_t class_id, Handle wrapper); + typedef RetainedObjectInfo* (*WrapperInfoCallback)(uint16_t class_id, + Local wrapper); /** Returns the number of snapshots taken. */ int GetSnapshotCount(); @@ -443,13 +443,13 @@ class V8_EXPORT HeapProfiler { * Returns SnapshotObjectId for a heap object referenced by |value| if * it has been seen by the heap profiler, kUnknownObjectId otherwise. */ - SnapshotObjectId GetObjectId(Handle value); + SnapshotObjectId GetObjectId(Local value); /** * Returns heap object with given SnapshotObjectId if the object is alive, * otherwise empty handle is returned. */ - Handle FindObjectById(SnapshotObjectId id); + Local FindObjectById(SnapshotObjectId id); /** * Clears internal map from SnapshotObjectId to heap object. The new objects @@ -474,7 +474,8 @@ class V8_EXPORT HeapProfiler { * Returns name to be used in the heap snapshot for given node. Returned * string must stay alive until snapshot collection is completed. */ - virtual const char* GetName(Handle object) = 0; + virtual const char* GetName(Local object) = 0; + protected: virtual ~ObjectNameResolver() {} }; diff --git a/include/v8.h b/include/v8.h index 6d314ba16..6e1db3a58 100644 --- a/include/v8.h +++ b/include/v8.h @@ -215,8 +215,8 @@ class Local { : val_(reinterpret_cast(*that)) { /** * This check fails when trying to convert between incompatible - * handles. For example, converting from a Handle to a - * Handle. + * handles. For example, converting from a Local to a + * Local. */ TYPE_CHECK(T, S); } @@ -330,9 +330,11 @@ class Local { }; -// Handle is an alias for Local for historical reasons. +#if !defined(V8_IMMINENT_DEPRECATION_WARNINGS) +// Local is an alias for Local for historical reasons. template using Handle = Local; +#endif /** @@ -495,7 +497,7 @@ template class PersistentBase { * and create a new one with the contents of other if other is non empty */ template - V8_INLINE void Reset(Isolate* isolate, const Handle& other); + V8_INLINE void Reset(Isolate* isolate, const Local& other); /** * If non-empty, destroy the underlying storage cell @@ -516,7 +518,8 @@ template class PersistentBase { return *a == *b; } - template V8_INLINE bool operator==(const Handle& that) const { + template + V8_INLINE bool operator==(const Local& that) const { internal::Object** a = reinterpret_cast(this->val_); internal::Object** b = reinterpret_cast(that.val_); if (a == NULL) return b == NULL; @@ -529,7 +532,8 @@ template class PersistentBase { return !operator==(that); } - template V8_INLINE bool operator!=(const Handle& that) const { + template + V8_INLINE bool operator!=(const Local& that) const { return !operator==(that); } @@ -692,11 +696,12 @@ template class Persistent : public PersistentBase { */ V8_INLINE Persistent() : PersistentBase(0) { } /** - * Construct a Persistent from a Handle. - * When the Handle is non-empty, a new storage cell is created + * Construct a Persistent from a Local. + * When the Local is non-empty, a new storage cell is created * pointing to the same object, and no flags are set. */ - template V8_INLINE Persistent(Isolate* isolate, Handle that) + template + V8_INLINE Persistent(Isolate* isolate, Local that) : PersistentBase(PersistentBase::New(isolate, *that)) { TYPE_CHECK(T, S); } @@ -784,12 +789,12 @@ class Global : public PersistentBase { */ V8_INLINE Global() : PersistentBase(nullptr) {} /** - * Construct a Global from a Handle. - * When the Handle is non-empty, a new storage cell is created + * Construct a Global from a Local. + * When the Local is non-empty, a new storage cell is created * pointing to the same object, and no flags are set. */ template - V8_INLINE Global(Isolate* isolate, Handle that) + V8_INLINE Global(Isolate* isolate, Local that) : PersistentBase(PersistentBase::New(isolate, *that)) { TYPE_CHECK(T, S); } @@ -1012,31 +1017,31 @@ class ScriptOriginOptions { class ScriptOrigin { public: V8_INLINE ScriptOrigin( - Handle resource_name, - Handle resource_line_offset = Handle(), - Handle resource_column_offset = Handle(), - Handle resource_is_shared_cross_origin = Handle(), - Handle script_id = Handle(), - Handle resource_is_embedder_debug_script = Handle(), - Handle source_map_url = Handle(), - Handle resource_is_opaque = Handle()); - V8_INLINE Handle ResourceName() const; - V8_INLINE Handle ResourceLineOffset() const; - V8_INLINE Handle ResourceColumnOffset() const; + Local resource_name, + Local resource_line_offset = Local(), + Local resource_column_offset = Local(), + Local resource_is_shared_cross_origin = Local(), + Local script_id = Local(), + Local resource_is_embedder_debug_script = Local(), + Local source_map_url = Local(), + Local resource_is_opaque = Local()); + V8_INLINE Local ResourceName() const; + V8_INLINE Local ResourceLineOffset() const; + V8_INLINE Local ResourceColumnOffset() const; /** * Returns true for embedder's debugger scripts */ - V8_INLINE Handle ScriptID() const; - V8_INLINE Handle SourceMapUrl() const; + V8_INLINE Local ScriptID() const; + V8_INLINE Local SourceMapUrl() const; V8_INLINE ScriptOriginOptions Options() const { return options_; } private: - Handle resource_name_; - Handle resource_line_offset_; - Handle resource_column_offset_; + Local resource_name_; + Local resource_line_offset_; + Local resource_column_offset_; ScriptOriginOptions options_; - Handle script_id_; - Handle source_map_url_; + Local script_id_; + Local source_map_url_; }; @@ -1051,16 +1056,16 @@ class V8_EXPORT UnboundScript { Local