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

Side by Side Diff: include/AdblockPlus/JsValue.h

Issue 4949583905947648: Issue 1280 - Update v8, the second part (Closed)
Patch Set: Created Oct. 27, 2014, 10:01 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | include/AdblockPlus/V8ValueHolder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #ifndef ADBLOCK_PLUS_JS_VALUE_H 18 #ifndef ADBLOCK_PLUS_JS_VALUE_H
19 #define ADBLOCK_PLUS_JS_VALUE_H 19 #define ADBLOCK_PLUS_JS_VALUE_H
20 20
21 #include <stdint.h> 21 #include <cstdint>
22 #include <string> 22 #include <string>
23 #include <vector> 23 #include <vector>
24 #include "tr1_memory.h" 24 #include "tr1_memory.h"
25 #include "V8ValueHolder.h" 25 #include <v8.h>
26
27 namespace v8
28 {
29 class Value;
30 template<class T> class Handle;
31 template<class T> class Local;
32 }
33 26
34 namespace AdblockPlus 27 namespace AdblockPlus
35 { 28 {
36 class JsValue; 29 class JsValue;
37 class JsEngine; 30 class JsEngine;
38 31
39 typedef std::tr1::shared_ptr<JsEngine> JsEnginePtr; 32 typedef std::tr1::shared_ptr<JsEngine> JsEnginePtr;
40 33
41 /** 34 /**
42 * Shared smart pointer to a `JsValue` instance. 35 * Shared smart pointer to a `JsValue` instance.
(...skipping 17 matching lines...) Expand all
60 private: 53 private:
61 // allow access to the ctr only JsEngine and don't allow JsEngine to acces s other members. 54 // allow access to the ctr only JsEngine and don't allow JsEngine to acces s other members.
62 friend class JsEngine; 55 friend class JsEngine;
63 friend class JsValue; 56 friend class JsValue;
64 struct CtrArg 57 struct CtrArg
65 { 58 {
66 }; 59 };
67 }; 60 };
68 protected: 61 protected:
69 typedef Private::CtrArg PrivateCtrArg; 62 typedef Private::CtrArg PrivateCtrArg;
70 JsValue(const JsValuePtr& value); 63 JsValue(JsValue&& src);
71 public: 64 public:
72 JsValue(const JsEnginePtr& jsEngine, const v8::Handle<v8::Value> value, Priv ateCtrArg); 65 JsValue(const JsEnginePtr& jsEngine, const v8::Handle<v8::Value> value, Priv ateCtrArg);
73 virtual ~JsValue(); 66 virtual ~JsValue();
74 67
75 bool IsUndefined() const; 68 bool IsUndefined() const;
76 bool IsNull() const; 69 bool IsNull() const;
77 bool IsString() const; 70 bool IsString() const;
78 bool IsNumber() const; 71 bool IsNumber() const;
79 bool IsBool() const; 72 bool IsBool() const;
80 bool IsObject() const; 73 bool IsObject() const;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 */ 129 */
137 JsValuePtr Call(const JsValueList& params = JsValueList(), 130 JsValuePtr Call(const JsValueList& params = JsValueList(),
138 AdblockPlus::JsValuePtr thisPtr = AdblockPlus::JsValuePtr()) const; 131 AdblockPlus::JsValuePtr thisPtr = AdblockPlus::JsValuePtr()) const;
139 132
140 v8::Local<v8::Value> unwrapValue() const; 133 v8::Local<v8::Value> unwrapValue() const;
141 private: 134 private:
142 void SetProperty(const std::string& name, const v8::Handle<v8::Value> val); 135 void SetProperty(const std::string& name, const v8::Handle<v8::Value> val);
143 protected: 136 protected:
144 JsEnginePtr jsEngine; 137 JsEnginePtr jsEngine;
145 private: 138 private:
146 V8ValueHolder<v8::Value> value; 139 v8::UniquePersistent<v8::Value> value;
147 }; 140 };
148 } 141 }
149 142
150 #endif 143 #endif
OLDNEW
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | include/AdblockPlus/V8ValueHolder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld