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

Delta Between Two Patch Sets: compiled/bindings/main.cpp

Issue 29410617: Issue 5131 - [emscripten] Clean separation of bindings code and runtime code (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Left Patch Set: Created April 12, 2017, 2:07 p.m.
Right Patch Set: Rebased Created April 20, 2017, 1:49 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « compiled/bindings/generator.cpp ('k') | compiled/bindings/runtime_utils.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
(...skipping 21 matching lines...) Expand all
32 #include "../filter/ElemHideEmulationFilter.h" 32 #include "../filter/ElemHideEmulationFilter.h"
33 #include "../subscription/Subscription.h" 33 #include "../subscription/Subscription.h"
34 #include "../subscription/DownloadableSubscription.h" 34 #include "../subscription/DownloadableSubscription.h"
35 #include "../subscription/UserDefinedSubscription.h" 35 #include "../subscription/UserDefinedSubscription.h"
36 #include "../FilterNotifier.h" 36 #include "../FilterNotifier.h"
37 37
38 int main() 38 int main()
39 { 39 {
40 try 40 try
41 { 41 {
42 class_<Filter>("Filter") 42 class_<Filter>("Filter")
sergei 2017/04/20 14:52:00 Maybe it worth to leave these code in a function a
Wladimir Palant 2017/04/20 14:54:29 This is worth considering but let's land this chan
43 .property("text", &Filter::GetText) 43 .property("text", &Filter::GetText)
44 .function("serialize", &Filter::Serialize) 44 .function("serialize", &Filter::Serialize)
45 .class_function("fromText", &Filter::FromText) 45 .class_function("fromText", &Filter::FromText)
46 .subclass_differentiator(&Filter::mType, { 46 .subclass_differentiator(&Filter::mType, {
47 {Filter::Type::INVALID, "InvalidFilter"}, 47 {Filter::Type::INVALID, "InvalidFilter"},
48 {Filter::Type::COMMENT, "CommentFilter"}, 48 {Filter::Type::COMMENT, "CommentFilter"},
49 {Filter::Type::BLOCKING, "BlockingFilter"}, 49 {Filter::Type::BLOCKING, "BlockingFilter"},
50 {Filter::Type::WHITELIST, "WhitelistFilter"}, 50 {Filter::Type::WHITELIST, "WhitelistFilter"},
51 {Filter::Type::ELEMHIDE, "ElemHideFilter"}, 51 {Filter::Type::ELEMHIDE, "ElemHideFilter"},
52 {Filter::Type::ELEMHIDEEXCEPTION, "ElemHideException"}, 52 {Filter::Type::ELEMHIDEEXCEPTION, "ElemHideException"},
(...skipping 12 matching lines...) Expand all
65 .property("hitCount", &ActiveFilter::GetHitCount, &ActiveFilter::SetHitC ount) 65 .property("hitCount", &ActiveFilter::GetHitCount, &ActiveFilter::SetHitC ount)
66 .property("lastHit", &ActiveFilter::GetLastHit, &ActiveFilter::SetLastHi t) 66 .property("lastHit", &ActiveFilter::GetLastHit, &ActiveFilter::SetLastHi t)
67 .function("isActiveOnDomain", &ActiveFilter::IsActiveOnDomain) 67 .function("isActiveOnDomain", &ActiveFilter::IsActiveOnDomain)
68 .function("isActiveOnlyOnDomain", &ActiveFilter::IsActiveOnlyOnDomain) 68 .function("isActiveOnlyOnDomain", &ActiveFilter::IsActiveOnlyOnDomain)
69 .function("isGeneric", &ActiveFilter::IsGeneric) 69 .function("isGeneric", &ActiveFilter::IsGeneric)
70 .function("serialize", &ActiveFilter::Serialize); 70 .function("serialize", &ActiveFilter::Serialize);
71 71
72 class_<RegExpFilter,ActiveFilter>("RegExpFilter") 72 class_<RegExpFilter,ActiveFilter>("RegExpFilter")
73 .function("matches", &RegExpFilter::Matches); 73 .function("matches", &RegExpFilter::Matches);
74 74
75 custom_generator(&RegExpFilter::GenerateCustomBindings);
76
77 class_<BlockingFilter,RegExpFilter>("BlockingFilter") 75 class_<BlockingFilter,RegExpFilter>("BlockingFilter")
78 .class_property("type", "'blocking'"); 76 .class_property("type", "'blocking'");
79 77
80 class_<WhitelistFilter,RegExpFilter>("WhitelistFilter") 78 class_<WhitelistFilter,RegExpFilter>("WhitelistFilter")
81 .class_property("type", "'whitelist'"); 79 .class_property("type", "'whitelist'");
82 80
83 class_<ElemHideBase,ActiveFilter>("ElemHideBase") 81 class_<ElemHideBase,ActiveFilter>("ElemHideBase")
84 .property("selector", &ElemHideBase::GetSelector) 82 .property("selector", &ElemHideBase::GetSelector)
85 .property("selectorDomain", &ElemHideBase::GetSelectorDomain); 83 .property("selectorDomain", &ElemHideBase::GetSelectorDomain);
86 84
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 .property("softExpiration", &DownloadableSubscription::GetSoftExpiration , &DownloadableSubscription::SetSoftExpiration) 121 .property("softExpiration", &DownloadableSubscription::GetSoftExpiration , &DownloadableSubscription::SetSoftExpiration)
124 .property("lastDownload", &DownloadableSubscription::GetLastDownload, &D ownloadableSubscription::SetLastDownload) 122 .property("lastDownload", &DownloadableSubscription::GetLastDownload, &D ownloadableSubscription::SetLastDownload)
125 .property("downloadStatus", &DownloadableSubscription::GetDownloadStatus , &DownloadableSubscription::SetDownloadStatus) 123 .property("downloadStatus", &DownloadableSubscription::GetDownloadStatus , &DownloadableSubscription::SetDownloadStatus)
126 .property("lastSuccess", &DownloadableSubscription::GetLastSuccess, &Dow nloadableSubscription::SetLastSuccess) 124 .property("lastSuccess", &DownloadableSubscription::GetLastSuccess, &Dow nloadableSubscription::SetLastSuccess)
127 .property("errors", &DownloadableSubscription::GetErrorCount, &Downloada bleSubscription::SetErrorCount) 125 .property("errors", &DownloadableSubscription::GetErrorCount, &Downloada bleSubscription::SetErrorCount)
128 .property("version", &DownloadableSubscription::GetDataRevision, &Downlo adableSubscription::SetDataRevision) 126 .property("version", &DownloadableSubscription::GetDataRevision, &Downlo adableSubscription::SetDataRevision)
129 .property("requiredVersion", &DownloadableSubscription::GetRequiredVersi on, &DownloadableSubscription::SetRequiredVersion) 127 .property("requiredVersion", &DownloadableSubscription::GetRequiredVersi on, &DownloadableSubscription::SetRequiredVersion)
130 .property("downloadCount", &DownloadableSubscription::GetDownloadCount, &DownloadableSubscription::SetDownloadCount) 128 .property("downloadCount", &DownloadableSubscription::GetDownloadCount, &DownloadableSubscription::SetDownloadCount)
131 .function("serialize", &DownloadableSubscription::Serialize); 129 .function("serialize", &DownloadableSubscription::Serialize);
132 130
133 custom_generator(&FilterNotifier::GenerateCustomBindings); 131 printBindings();
132 RegExpFilter::GenerateCustomBindings();
133 FilterNotifier::GenerateCustomBindings();
134 134
135 printBindings();
136 return 0; 135 return 0;
137 } 136 }
138 catch (const std::exception& e) 137 catch (const std::exception& e)
139 { 138 {
140 EM_ASM_ARGS( 139 EM_ASM_ARGS(
141 console.error("Error occurred generating JavaScript bindings: " + 140 console.error("Error occurred generating JavaScript bindings: " +
142 Module.AsciiToString($0)), e.what() 141 Module.AsciiToString($0)), e.what()
143 ); 142 );
144 return 1; 143 return 1;
145 } 144 }
146 } 145 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld