Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: include/AdblockPlus/V8ValueHolder.h

Issue 6090724420354048: Noissue - Upgraded to latest libadblockplus version, included v8 includes (Closed)
Patch Set: Removed v8 includes Created Jan. 29, 2015, 5:09 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/AdblockPlus/V8ValueHolder.h
diff --git a/include/AdblockPlus/V8ValueHolder.h b/include/AdblockPlus/V8ValueHolder.h
index 8b17859b4e1d98b69221f5eb7aae112d39e4f104..254f3652651ac714769d9e07bdbfb91faf34d4c6 100644
--- a/include/AdblockPlus/V8ValueHolder.h
+++ b/include/AdblockPlus/V8ValueHolder.h
@@ -1,6 +1,6 @@
/*
- * This file is part of Adblock Plus <http://adblockplus.org/>,
- * Copyright (C) 2006-2014 Eyeo GmbH
+ * This file is part of Adblock Plus <https://adblockplus.org/>,
+ * Copyright (C) 2006-2015 Eyeo GmbH
*
* Adblock Plus is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
@@ -33,17 +33,10 @@ namespace AdblockPlus
class V8ValueHolder
{
public:
+ typedef typename v8::Persistent<T> V8Persistent;
V8ValueHolder()
{
- reset(0, v8::Persistent<T>());
- }
- V8ValueHolder(V8ValueHolder& value)
- {
- reset(value.isolate, static_cast<v8::Handle<T> >(value));
- }
- V8ValueHolder(v8::Isolate* isolate, v8::Persistent<T> value)
- {
- reset(isolate, value);
+ reset();
}
V8ValueHolder(v8::Isolate* isolate, v8::Handle<T> value)
{
@@ -57,7 +50,11 @@ namespace AdblockPlus
this->value.reset(0);
}
}
- void reset(v8::Isolate* isolate, v8::Persistent<T> value)
+ void reset(v8::Isolate* isolate, v8::Handle<T> value)
+ {
+ reset(isolate, std::auto_ptr<V8Persistent>(new V8Persistent(isolate, value)));
+ }
+ void reset(v8::Isolate* isolate = 0, std::auto_ptr<V8Persistent> value = std::auto_ptr<V8Persistent>(new V8Persistent()))
{
if (this->value.get())
{
@@ -65,33 +62,20 @@ namespace AdblockPlus
this->value.reset(0);
}
- if (!value.IsEmpty())
+ if (!value->IsEmpty())
{
this->isolate = isolate;
- this->value.reset(new v8::Persistent<T>(value));
+ this->value = value;
}
}
- void reset(v8::Isolate* isolate, v8::Handle<T> value)
- {
- reset(isolate, v8::Persistent<T>::New(isolate, value));
- }
-
- T* operator->() const
- {
- return **value;
- }
- operator v8::Handle<T>() const
- {
- return *value;
- }
- operator v8::Persistent<T>() const
+ operator V8Persistent&() const
{
return *value;
}
private:
v8::Isolate* isolate;
- std::auto_ptr<v8::Persistent<T> > value;
+ std::auto_ptr<V8Persistent> value;
};
}

Powered by Google App Engine
This is Rietveld