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

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

Issue 5163715573841920: Issue 768 - Switch from TR1 to C++11 (Closed)
Patch Set: fix including of <memory> Created Aug. 7, 2015, 6:07 a.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/FilterEngine.h ('k') | include/AdblockPlus/JsValue.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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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_ENGINE_H 18 #ifndef ADBLOCK_PLUS_JS_ENGINE_H
19 #define ADBLOCK_PLUS_JS_ENGINE_H 19 #define ADBLOCK_PLUS_JS_ENGINE_H
20 20
21 #include <functional>
21 #include <map> 22 #include <map>
22 #include <stdexcept> 23 #include <stdexcept>
23 #include <stdint.h> 24 #include <stdint.h>
24 #include <string> 25 #include <string>
25 #include <AdblockPlus/AppInfo.h> 26 #include <AdblockPlus/AppInfo.h>
26 #include <AdblockPlus/tr1_functional.h>
27 #include <AdblockPlus/LogSystem.h> 27 #include <AdblockPlus/LogSystem.h>
28 #include <AdblockPlus/FileSystem.h> 28 #include <AdblockPlus/FileSystem.h>
29 #include <AdblockPlus/JsValue.h> 29 #include <AdblockPlus/JsValue.h>
30 #include <AdblockPlus/WebRequest.h> 30 #include <AdblockPlus/WebRequest.h>
31 31
32 #include "tr1_memory.h"
33 #include "V8ValueHolder.h" 32 #include "V8ValueHolder.h"
34 33
35 namespace v8 34 namespace v8
36 { 35 {
37 class Arguments; 36 class Arguments;
38 class Isolate; 37 class Isolate;
39 class Value; 38 class Value;
40 class Context; 39 class Context;
41 template<class T> class Handle; 40 template<class T> class Handle;
42 typedef Handle<Value>(*InvocationCallback)(const Arguments &args); 41 typedef Handle<Value>(*InvocationCallback)(const Arguments &args);
43 } 42 }
44 43
45 namespace AdblockPlus 44 namespace AdblockPlus
46 { 45 {
47 class JsEngine; 46 class JsEngine;
48 47
49 /** 48 /**
50 * Shared smart pointer to a `JsEngine` instance. 49 * Shared smart pointer to a `JsEngine` instance.
51 */ 50 */
52 typedef std::tr1::shared_ptr<JsEngine> JsEnginePtr; 51 typedef std::shared_ptr<JsEngine> JsEnginePtr;
53 52
54 /** 53 /**
55 * JavaScript engine used by `FilterEngine`, wraps v8. 54 * JavaScript engine used by `FilterEngine`, wraps v8.
56 */ 55 */
57 class JsEngine : public std::tr1::enable_shared_from_this<JsEngine> 56 class JsEngine : public std::enable_shared_from_this<JsEngine>
58 { 57 {
59 friend class JsValue; 58 friend class JsValue;
60 friend class JsContext; 59 friend class JsContext;
61 60
62 public: 61 public:
63 /** 62 /**
64 * Event callback function. 63 * Event callback function.
65 */ 64 */
66 typedef std::tr1::function<void(JsValueList& params)> EventCallback; 65 typedef std::function<void(JsValueList& params)> EventCallback;
67 66
68 /** 67 /**
69 * Maps events to callback functions. 68 * Maps events to callback functions.
70 */ 69 */
71 typedef std::map<std::string, EventCallback> EventMap; 70 typedef std::map<std::string, EventCallback> EventMap;
72 71
73 /** 72 /**
74 * Creates a new JavaScript engine instance. 73 * Creates a new JavaScript engine instance.
75 * @param appInfo Information about the app. 74 * @param appInfo Information about the app.
76 * @return New `JsEngine` instance. 75 * @return New `JsEngine` instance.
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 WebRequestPtr webRequest; 224 WebRequestPtr webRequest;
226 LogSystemPtr logSystem; 225 LogSystemPtr logSystem;
227 v8::Isolate* isolate; 226 v8::Isolate* isolate;
228 V8ValueHolder<v8::Context> context; 227 V8ValueHolder<v8::Context> context;
229 EventMap eventCallbacks; 228 EventMap eventCallbacks;
230 JsValuePtr globalJsObject; 229 JsValuePtr globalJsObject;
231 }; 230 };
232 } 231 }
233 232
234 #endif 233 #endif
OLDNEW
« no previous file with comments | « include/AdblockPlus/FilterEngine.h ('k') | include/AdblockPlus/JsValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld