Make sure all native resources get freed on exit

This commit is contained in:
Cheng Zhao 2015-11-04 18:21:03 +08:00
parent 07c55f321f
commit d56b34de3b
11 changed files with 56 additions and 17 deletions

View file

@ -8,7 +8,7 @@
#include <string>
#include <vector>
#include "atom/browser/api/event_emitter.h"
#include "atom/browser/api/trackable_object.h"
#include "atom/browser/ui/tray_icon_observer.h"
#include "base/memory/scoped_ptr.h"
@ -29,7 +29,7 @@ namespace api {
class Menu;
class Tray : public mate::EventEmitter,
class Tray : public mate::TrackableObject<Tray>,
public TrayIconObserver {
public:
static mate::Wrappable* New(v8::Isolate* isolate, const gfx::Image& image);
@ -39,7 +39,7 @@ class Tray : public mate::EventEmitter,
protected:
explicit Tray(const gfx::Image& image);
virtual ~Tray();
~Tray() override;
// TrayIconObserver:
void OnClicked(const gfx::Rect& bounds, int modifiers) override;
@ -53,7 +53,9 @@ class Tray : public mate::EventEmitter,
// mate::Wrappable:
bool IsDestroyed() const override;
void Destroy();
// mate::TrackableObject:
void Destroy() override;
void SetImage(mate::Arguments* args, const gfx::Image& image);
void SetPressedImage(mate::Arguments* args, const gfx::Image& image);
void SetToolTip(mate::Arguments* args, const std::string& tool_tip);