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

Delta Between Two Patch Sets: compiled/Filter.h

Issue 29333474: Issue 4125 - [emscripten] Convert filter classes to C++ (Closed)
Left Patch Set: Addressed comments from Patch Set 24 Created Dec. 6, 2016, 10:43 a.m.
Right Patch Set: Addressed comments from Patch Set 28 Created March 21, 2017, 10:04 a.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/ElemHideFilter.cpp ('k') | compiled/Filter.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 #pragma once 1 #pragma once
2 2
3 #include <vector> 3 #include <vector>
4 4
5 #include "String.h" 5 #include "String.h"
6 #include "intrusive_ptr.h" 6 #include "intrusive_ptr.h"
7 #include "debug.h" 7 #include "debug.h"
8 8
9 class Filter : public ref_counted 9 class Filter : public ref_counted
10 { 10 {
11 protected: 11 protected:
12 OwnedString mText; 12 OwnedString mText;
13 13
14 public: 14 public:
15 enum Type 15 enum Type
16 { 16 {
17 UNKNOWN = 0, 17 UNKNOWN = 0,
18 INVALID = 1, 18 INVALID = 1,
19 COMMENT = 2, 19 COMMENT = 2,
20 BLOCKING = 3, 20 BLOCKING = 3,
21 WHITELIST = 4, 21 WHITELIST = 4,
22 ELEMHIDE = 5, 22 ELEMHIDE = 5,
23 ELEMHIDEEXCEPTION = 6, 23 ELEMHIDEEXCEPTION = 6,
24 CSSPROPERTY = 7, 24 CSSPROPERTY = 7,
25 }; 25 };
26 26
27 explicit Filter(Type type, const String& text); 27 explicit Filter(Type type, const String& text);
sergei 2017/01/10 15:57:46 Just observation: Before C++11 the compiler was al
Wladimir Palant 2017/03/13 17:42:03 I see. Here it rather seems to be a left-over from
28 virtual ~Filter(); 28 ~Filter();
sergei 2017/01/10 15:57:48 I'm not sure that we need to say virtual here beca
Wladimir Palant 2017/03/13 17:42:08 Done.
29 29
30 Type mType; 30 Type mType;
sergei 2017/01/10 15:57:44 I guess it's a public member only for the sake of
Wladimir Palant 2017/03/13 17:42:06 Yes, we were calling a function originally in orde
31 31
32 /* TODO 32 /* TODO
33 std::vector<Subscription> mSubscriptions; 33 std::vector<Subscription> mSubscriptions;
34 */ 34 */
35 35
36 EMSCRIPTEN_KEEPALIVE const String& GetText() const 36 EMSCRIPTEN_KEEPALIVE const String& GetText() const
37 { 37 {
38 return mText; 38 return mText;
39 } 39 }
40 40
41 EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const; 41 EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const;
42 42
43 static EMSCRIPTEN_KEEPALIVE Type GetType(Filter* filter)
sergei 2017/01/10 15:57:42 It seems we don't need this method anymore.
Wladimir Palant 2017/03/13 17:42:01 Done.
44 {
45 return filter->mType;
46 }
47
48 static EMSCRIPTEN_KEEPALIVE Filter* FromText(DependentString& text); 43 static EMSCRIPTEN_KEEPALIVE Filter* FromText(DependentString& text);
49 }; 44 };
50 45
51 typedef intrusive_ptr<Filter> FilterPtr; 46 typedef intrusive_ptr<Filter> FilterPtr;
LEFTRIGHT

Powered by Google App Engine
This is Rietveld