build: fix building with enable_remote_module = false (#23499)

This commit is contained in:
Milan Burda 2020-05-12 18:32:04 +02:00 committed by GitHub
parent 633f3c2413
commit ef176ce368
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 13 additions and 13 deletions

View file

@ -1,41 +0,0 @@
// Copyright (c) 2013 GitHub, Inc.
// Copyright (c) 2012 Intel Corp. All rights reserved.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/common/api/remote/object_life_monitor.h"
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
namespace electron {
ObjectLifeMonitor::ObjectLifeMonitor(v8::Isolate* isolate,
v8::Local<v8::Object> target)
: target_(isolate, target), weak_ptr_factory_(this) {
target_.SetWeak(this, OnObjectGC, v8::WeakCallbackType::kParameter);
}
ObjectLifeMonitor::~ObjectLifeMonitor() {
if (target_.IsEmpty())
return;
target_.ClearWeak();
target_.Reset();
}
// static
void ObjectLifeMonitor::OnObjectGC(
const v8::WeakCallbackInfo<ObjectLifeMonitor>& data) {
ObjectLifeMonitor* self = data.GetParameter();
self->target_.Reset();
self->RunDestructor();
data.SetSecondPassCallback(Free);
}
// static
void ObjectLifeMonitor::Free(
const v8::WeakCallbackInfo<ObjectLifeMonitor>& data) {
delete data.GetParameter();
}
} // namespace electron

View file

@ -1,34 +0,0 @@
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_COMMON_API_REMOTE_OBJECT_LIFE_MONITOR_H_
#define SHELL_COMMON_API_REMOTE_OBJECT_LIFE_MONITOR_H_
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "v8/include/v8.h"
namespace electron {
class ObjectLifeMonitor {
protected:
ObjectLifeMonitor(v8::Isolate* isolate, v8::Local<v8::Object> target);
virtual ~ObjectLifeMonitor();
virtual void RunDestructor() = 0;
private:
static void OnObjectGC(const v8::WeakCallbackInfo<ObjectLifeMonitor>& data);
static void Free(const v8::WeakCallbackInfo<ObjectLifeMonitor>& data);
v8::Global<v8::Object> target_;
base::WeakPtrFactory<ObjectLifeMonitor> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ObjectLifeMonitor);
};
} // namespace electron
#endif // SHELL_COMMON_API_REMOTE_OBJECT_LIFE_MONITOR_H_

View file

@ -8,7 +8,7 @@
#include <string>
#include "content/public/browser/web_contents_observer.h"
#include "shell/common/api/remote/object_life_monitor.h"
#include "shell/common/api/object_life_monitor.h"
namespace electron {

View file

@ -8,7 +8,7 @@
#include <map>
#include <string>
#include "shell/common/api/remote/object_life_monitor.h"
#include "shell/common/api/object_life_monitor.h"
namespace electron {