Skip to content

Commit

Permalink
deps: V8: cherry-pick d5f08e4
Browse files Browse the repository at this point in the history
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 28, 2019
1 parent 963061b commit e6af220
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 24 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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 #####

Expand Down
4 changes: 0 additions & 4 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---
Expand Down
12 changes: 0 additions & 12 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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));
}
Expand Down
8 changes: 1 addition & 7 deletions deps/v8/src/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down

0 comments on commit e6af220

Please sign in to comment.