[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}
This commit is contained in:
Clemens Hammacher 2019-03-11 10:22:46 +01:00 committed by Commit Bot
parent 6be6d85d11
commit d5f08e4e4f
3 changed files with 1 additions and 23 deletions

View File

@ -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 ---

View File

@ -899,19 +899,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 =
@ -947,8 +937,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));
}

View File

@ -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_;