Skip to content
Permalink
Browse files

deps: V8: cherry-pick d5f08e4

Original commit message:

    [api] Remove unowned Extensions interface

    Extensions are now always passed via unique_ptr and are owned by V8.
    This CL removes the deprecated API where the embedder would own the
    Extension, but has no mechanism for deleting it.

    R=ulan@chromium.org

    Bug: v8:8725
    Change-Id: Icb83660fad9d04c66f8db2265091ebabcbb197c4
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1514493
    Reviewed-by: Yang Guo <yangguo@chromium.org>
    Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60186}

Refs: v8/v8@d5f08e4

PR-URL: #26685
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
  • Loading branch information...
addaleax authored and refack committed Mar 15, 2019
1 parent 963061b commit e6af2207a9d5a7602688379147662a2bb4ee4ce6
Showing with 2 additions and 24 deletions.
  1. +1 −1 common.gypi
  2. +0 −4 deps/v8/include/v8.h
  3. +0 −12 deps/v8/src/api.cc
  4. +1 −7 deps/v8/src/api.h
@@ -37,7 +37,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.6',
'v8_embedder_string': '-node.7',

##### V8 defaults for Node.js #####

@@ -6497,10 +6497,6 @@ class V8_EXPORT Extension { // NOLINT
bool auto_enable_;
};

V8_DEPRECATED(
"Use unique_ptr version or stop using extension (http://crbug.com/334679).",
void V8_EXPORT RegisterExtension(Extension* extension));

void V8_EXPORT RegisterExtension(std::unique_ptr<Extension>);

// --- Statics ---
@@ -898,19 +898,9 @@ void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {

RegisteredExtension* RegisteredExtension::first_extension_ = nullptr;

RegisteredExtension::RegisteredExtension(Extension* extension)
: legacy_unowned_extension_(extension) {}

RegisteredExtension::RegisteredExtension(std::unique_ptr<Extension> extension)
: extension_(std::move(extension)) {}

// static
void RegisteredExtension::Register(Extension* extension) {
RegisteredExtension* new_extension = new RegisteredExtension(extension);
new_extension->next_ = first_extension_;
first_extension_ = new_extension;
}

// static
void RegisteredExtension::Register(std::unique_ptr<Extension> extension) {
RegisteredExtension* new_extension =
@@ -946,8 +936,6 @@ class ExtensionResource : public String::ExternalOneByteStringResource {
};
} // anonymous namespace

void RegisterExtension(Extension* that) { RegisteredExtension::Register(that); }

void RegisterExtension(std::unique_ptr<Extension> extension) {
RegisteredExtension::Register(std::move(extension));
}
@@ -71,20 +71,14 @@ class ApiFunction {

class RegisteredExtension {
public:
static void Register(Extension*);
static void Register(std::unique_ptr<Extension>);
static void UnregisterAll();
Extension* extension() const {
return legacy_unowned_extension_ ? legacy_unowned_extension_
: extension_.get();
}
Extension* extension() const { return extension_.get(); }
RegisteredExtension* next() const { return next_; }
static RegisteredExtension* first_extension() { return first_extension_; }
private:
explicit RegisteredExtension(Extension*);
explicit RegisteredExtension(std::unique_ptr<Extension>);
// TODO(clemensh): Remove this after the 7.4 branch.
Extension* legacy_unowned_extension_ = nullptr;
std::unique_ptr<Extension> extension_;
RegisteredExtension* next_ = nullptr;
static RegisteredExtension* first_extension_;

0 comments on commit e6af220

Please sign in to comment.
You can’t perform that action at this time.