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

Side by Side Diff: compiled/subscription/Subscription.h

Issue 29425555: Issue 5201 - [emscripten] Replace EM_ASM calls by a custom JavaScript library (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Abstracted away all Emscripten dependencies Created May 3, 2017, 11:54 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
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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 #pragma once 18 #pragma once
19 19
20 #include <type_traits> 20 #include <type_traits>
21 #include <vector> 21 #include <vector>
22 22
23 #include "../filter/Filter.h" 23 #include "../filter/Filter.h"
24 #include "../String.h" 24 #include "../String.h"
25 #include "../FilterNotifier.h" 25 #include "../FilterNotifier.h"
26 #include "../intrusive_ptr.h" 26 #include "../intrusive_ptr.h"
27 #include "../debug.h" 27 #include "../debug.h"
28 #include "../bindings/runtime.h"
28 29
29 #define SUBSCRIPTION_PROPERTY_INTERNAL(field_type, param_type, name, topic, gett er, setter) \ 30 #define SUBSCRIPTION_PROPERTY_INTERNAL(field_type, param_type, name, topic, gett er, setter) \
30 private:\ 31 private:\
31 field_type name;\ 32 field_type name;\
32 public:\ 33 public:\
33 param_type EMSCRIPTEN_KEEPALIVE getter() const\ 34 param_type BINDINGS_EXPORTED getter() const\
34 {\ 35 {\
35 return name;\ 36 return name;\
36 }\ 37 }\
37 void EMSCRIPTEN_KEEPALIVE setter(param_type value)\ 38 void BINDINGS_EXPORTED setter(param_type value)\
38 {\ 39 {\
39 if (name != value)\ 40 if (name != value)\
40 {\ 41 {\
41 name = value;\ 42 name = value;\
42 if (FilterNotifier::Topic::topic != FilterNotifier::Topic::NONE)\ 43 if (FilterNotifier::Topic::topic != FilterNotifier::Topic::NONE)\
43 {\ 44 {\
44 FilterNotifier::SubscriptionChange(FilterNotifier::Topic::topic,\ 45 FilterNotifier::SubscriptionChange(FilterNotifier::Topic::topic,\
45 this);\ 46 this);\
46 }\ 47 }\
47 }\ 48 }\
(...skipping 18 matching lines...) Expand all
66 UNKNOWN = 0, 67 UNKNOWN = 0,
67 DOWNLOADABLE = 1, 68 DOWNLOADABLE = 1,
68 USERDEFINED = 2 69 USERDEFINED = 2
69 }; 70 };
70 71
71 explicit Subscription(Type type, const String& id); 72 explicit Subscription(Type type, const String& id);
72 ~Subscription(); 73 ~Subscription();
73 74
74 Type mType; 75 Type mType;
75 76
76 EMSCRIPTEN_KEEPALIVE const String& GetID() const 77 BINDINGS_EXPORTED const String& GetID() const
77 { 78 {
78 return mID; 79 return mID;
79 } 80 }
80 81
81 SUBSCRIPTION_STRING_PROPERTY(mTitle, SUBSCRIPTION_TITLE, GetTitle, SetTitle); 82 SUBSCRIPTION_STRING_PROPERTY(mTitle, SUBSCRIPTION_TITLE, GetTitle, SetTitle);
82 SUBSCRIPTION_PROPERTY(bool, mDisabled, SUBSCRIPTION_DISABLED, 83 SUBSCRIPTION_PROPERTY(bool, mDisabled, SUBSCRIPTION_DISABLED,
83 GetDisabled, SetDisabled); 84 GetDisabled, SetDisabled);
84 85
85 EMSCRIPTEN_KEEPALIVE unsigned GetFilterCount() const 86 BINDINGS_EXPORTED unsigned GetFilterCount() const
86 { 87 {
87 return mFilters.size(); 88 return mFilters.size();
88 } 89 }
89 90
90 EMSCRIPTEN_KEEPALIVE Filter* FilterAt(unsigned index); 91 BINDINGS_EXPORTED Filter* FilterAt(unsigned index);
91 EMSCRIPTEN_KEEPALIVE int IndexOfFilter(Filter* filter); 92 BINDINGS_EXPORTED int IndexOfFilter(Filter* filter);
92 EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const; 93 BINDINGS_EXPORTED OwnedString Serialize() const;
93 EMSCRIPTEN_KEEPALIVE OwnedString SerializeFilters() const; 94 BINDINGS_EXPORTED OwnedString SerializeFilters() const;
94 95
95 static EMSCRIPTEN_KEEPALIVE Subscription* FromID(const String& id); 96 static BINDINGS_EXPORTED Subscription* FromID(const String& id);
96 }; 97 };
97 98
98 typedef intrusive_ptr<Subscription> SubscriptionPtr; 99 typedef intrusive_ptr<Subscription> SubscriptionPtr;
OLDNEW
« no previous file with comments | « compiled/subscription/DownloadableSubscription.h ('k') | compiled/subscription/UserDefinedSubscription.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld