chore: remove native_mate (Part 9) (#20645)
* refactor: remove a few uses of native_mate/gfx_converter.h * refactor: deprecate mate::EventEmitter * refactor: add gin_helper::EventEmitter * refactor: convert a few classes to use gin_helper::EventEmitter * refactor: get rid of native_mate_converters/gfx_converter.h * fix: follow native_mate on reporting errors * fix: gin is weak at guessing parameter types * fix: incorrect full class name * fix: gin::Handle does not accept null
This commit is contained in:
parent
b155ebeeb3
commit
eb0e55c514
38 changed files with 532 additions and 326 deletions
|
@ -10,7 +10,7 @@
|
|||
#include "base/bind.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "native_mate/object_template_builder_deprecated.h"
|
||||
#include "shell/browser/api/event_emitter.h"
|
||||
#include "shell/browser/api/event_emitter_deprecated.h"
|
||||
#include "shell/common/key_weak_map.h"
|
||||
|
||||
namespace base {
|
||||
|
@ -51,9 +51,10 @@ class TrackableObjectBase {
|
|||
|
||||
// All instances of TrackableObject will be kept in a weak map and can be got
|
||||
// from its ID.
|
||||
template <typename T>
|
||||
class TrackableObject : public TrackableObjectBase,
|
||||
public mate::EventEmitter<T> {
|
||||
//
|
||||
// TODO(zcbenz): Remove "typename B" after removing native_mate.
|
||||
template <typename T, typename B = mate::EventEmitter<T>>
|
||||
class TrackableObject : public TrackableObjectBase, public B {
|
||||
public:
|
||||
// Mark the JS object as destroyed.
|
||||
void MarkDestroyed() {
|
||||
|
@ -126,11 +127,11 @@ class TrackableObject : public TrackableObjectBase,
|
|||
DISALLOW_COPY_AND_ASSIGN(TrackableObject);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
int32_t TrackableObject<T>::next_id_ = 0;
|
||||
template <typename T, typename B>
|
||||
int32_t TrackableObject<T, B>::next_id_ = 0;
|
||||
|
||||
template <typename T>
|
||||
electron::KeyWeakMap<int32_t>* TrackableObject<T>::weak_map_ = nullptr;
|
||||
template <typename T, typename B>
|
||||
electron::KeyWeakMap<int32_t>* TrackableObject<T, B>::weak_map_ = nullptr;
|
||||
|
||||
} // namespace mate
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue