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

Delta Between Two Patch Sets: include/AdblockPlus/Platform.h

Issue 29543810: Issue 5118 - Lock the platform interfaces before use (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Left Patch Set: Created Sept. 13, 2017, 5:21 p.m.
Right Patch Set: Last details Created Sept. 13, 2017, 8:17 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 | « no previous file | src/ConsoleJsObject.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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 /** 102 /**
103 * Synchronous equivalent of `CreateFilterEngineAsync`. 103 * Synchronous equivalent of `CreateFilterEngineAsync`.
104 * Internally it blocks and waits for finishing of certain asynchronous 104 * Internally it blocks and waits for finishing of certain asynchronous
105 * operations, please ensure that provided implementation does not lead to 105 * operations, please ensure that provided implementation does not lead to
106 * a dead lock. 106 * a dead lock.
107 */ 107 */
108 FilterEngine& GetFilterEngine(); 108 FilterEngine& GetFilterEngine();
109 109
110 typedef std::function<void(ITimer&)> WithTimerCallback; 110 typedef std::function<void(ITimer&)> WithTimerCallback;
111 void WithTimer(const WithTimerCallback&); 111 virtual void WithTimer(const WithTimerCallback&);
112 112
113 typedef std::function<void(IFileSystem&)> WithFileSystemCallback; 113 typedef std::function<void(IFileSystem&)> WithFileSystemCallback;
114 void WithFileSystem(const WithFileSystemCallback&); 114 virtual void WithFileSystem(const WithFileSystemCallback&);
115 115
116 typedef std::function<void(IWebRequest&)> WithWebRequestCallback; 116 typedef std::function<void(IWebRequest&)> WithWebRequestCallback;
117 void WithWebRequest(const WithWebRequestCallback&); 117 virtual void WithWebRequest(const WithWebRequestCallback&);
118 118
119 /** 119 typedef std::function<void(LogSystem&)> WithLogSystemCallback;
120 * @return The LogSystem implementation. 120 virtual void WithLogSystem(const WithLogSystemCallback&);
121 */
122 LogSystem& GetLogSystem();
123 121
124 private: 122 protected:
125 LogSystemPtr logSystem; 123 LogSystemPtr logSystem;
126 TimerPtr timer; 124 TimerPtr timer;
127 FileSystemPtr fileSystem; 125 FileSystemPtr fileSystem;
128 WebRequestPtr webRequest; 126 WebRequestPtr webRequest;
127 private:
129 // used for creation and deletion of modules. 128 // used for creation and deletion of modules.
130 std::mutex modulesMutex; 129 std::mutex modulesMutex;
131 std::recursive_mutex interfacesMutex;
132 std::shared_ptr<JsEngine> jsEngine; 130 std::shared_ptr<JsEngine> jsEngine;
133 std::shared_future<FilterEnginePtr> filterEngine; 131 std::shared_future<FilterEnginePtr> filterEngine;
134 }; 132 };
135 133
136 /** 134 /**
137 * A helper class allowing to construct a default Platform and to obtain 135 * A helper class allowing to construct a default Platform and to obtain
138 * the Scheduler used by Platform before the latter is constructed. 136 * the Scheduler used by Platform before the latter is constructed.
139 */ 137 */
140 class DefaultPlatformBuilder : public Platform::CreationParameters 138 class DefaultPlatformBuilder : public Platform::CreationParameters
141 { 139 {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 * when a corresponding field is nullptr and with a default Scheduler. 172 * when a corresponding field is nullptr and with a default Scheduler.
175 */ 173 */
176 std::unique_ptr<Platform> CreatePlatform(); 174 std::unique_ptr<Platform> CreatePlatform();
177 private: 175 private:
178 std::shared_ptr<Scheduler> asyncExecutor; 176 std::shared_ptr<Scheduler> asyncExecutor;
179 Scheduler defaultScheduler; 177 Scheduler defaultScheduler;
180 }; 178 };
181 } 179 }
182 180
183 #endif // ADBLOCK_PLUS_PLATFORM_H 181 #endif // ADBLOCK_PLUS_PLATFORM_H
LEFTRIGHT

Powered by Google App Engine
This is Rietveld