LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 ~V8ValueHolder() | 45 ~V8ValueHolder() |
46 { | 46 { |
47 if (this->value.get()) | 47 if (this->value.get()) |
48 { | 48 { |
49 this->value->Dispose(this->isolate); | 49 this->value->Dispose(this->isolate); |
50 this->value.reset(0); | 50 this->value.reset(0); |
51 } | 51 } |
52 } | 52 } |
53 void reset(v8::Isolate* isolate, v8::Handle<T> value) | 53 void reset(v8::Isolate* isolate, v8::Handle<T> value) |
54 { | 54 { |
55 reset(isolate, std::auto_ptr<V8Persistent>(new V8Persistent(isolate, val
ue))); | 55 reset(isolate, std::auto_ptr<V8Persistent>(new V8Persistent(isolate, value
))); |
56 } | 56 } |
57 void reset(v8::Isolate* isolate = 0, std::auto_ptr<V8Persistent> value = std
::auto_ptr<V8Persistent>(new V8Persistent())) | 57 void reset(v8::Isolate* isolate = 0, std::auto_ptr<V8Persistent> value = std
::auto_ptr<V8Persistent>(new V8Persistent())) |
58 { | 58 { |
59 if (this->value.get()) | 59 if (this->value.get()) |
60 { | 60 { |
61 this->value->Dispose(this->isolate); | 61 this->value->Dispose(this->isolate); |
62 this->value.reset(0); | 62 this->value.reset(0); |
63 } | 63 } |
64 | 64 |
65 if (!value->IsEmpty()) | 65 if (!value->IsEmpty()) |
66 { | 66 { |
67 this->isolate = isolate; | 67 this->isolate = isolate; |
68 this->value = value; | 68 this->value = value; |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 operator V8Persistent&() const | 72 operator V8Persistent&() const |
73 { | 73 { |
74 return *value; | 74 return *value; |
75 } | 75 } |
76 private: | 76 private: |
77 v8::Isolate* isolate; | 77 v8::Isolate* isolate; |
78 std::auto_ptr<V8Persistent> value; | 78 std::auto_ptr<V8Persistent> value; |
79 }; | 79 }; |
80 } | 80 } |
81 | 81 |
82 #endif | 82 #endif |
LEFT | RIGHT |