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: Added missing LogSystem Created Sept. 13, 2017, 5:46 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 typedef std::function<void(LogSystem&)> WithLogSystemCallback; 119 typedef std::function<void(LogSystem&)> WithLogSystemCallback;
120 void WithLogSystem(const WithLogSystemCallback&); 120 virtual void WithLogSystem(const WithLogSystemCallback&);
121 121
122 private: 122 protected:
123 LogSystemPtr logSystem; 123 LogSystemPtr logSystem;
124 TimerPtr timer; 124 TimerPtr timer;
125 FileSystemPtr fileSystem; 125 FileSystemPtr fileSystem;
126 WebRequestPtr webRequest; 126 WebRequestPtr webRequest;
127 private:
127 // used for creation and deletion of modules. 128 // used for creation and deletion of modules.
128 std::mutex modulesMutex; 129 std::mutex modulesMutex;
129 std::recursive_mutex interfacesMutex;
sergei 2017/09/13 19:20:53 What do you think about making the methods WithSom
hub 2017/09/13 19:50:49 I can do that.
130 std::shared_ptr<JsEngine> jsEngine; 130 std::shared_ptr<JsEngine> jsEngine;
131 std::shared_future<FilterEnginePtr> filterEngine; 131 std::shared_future<FilterEnginePtr> filterEngine;
132 }; 132 };
133 133
134 /** 134 /**
135 * 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
136 * the Scheduler used by Platform before the latter is constructed. 136 * the Scheduler used by Platform before the latter is constructed.
137 */ 137 */
138 class DefaultPlatformBuilder : public Platform::CreationParameters 138 class DefaultPlatformBuilder : public Platform::CreationParameters
139 { 139 {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 * when a corresponding field is nullptr and with a default Scheduler. 172 * when a corresponding field is nullptr and with a default Scheduler.
173 */ 173 */
174 std::unique_ptr<Platform> CreatePlatform(); 174 std::unique_ptr<Platform> CreatePlatform();
175 private: 175 private:
176 std::shared_ptr<Scheduler> asyncExecutor; 176 std::shared_ptr<Scheduler> asyncExecutor;
177 Scheduler defaultScheduler; 177 Scheduler defaultScheduler;
178 }; 178 };
179 } 179 }
180 180
181 #endif // ADBLOCK_PLUS_PLATFORM_H 181 #endif // ADBLOCK_PLUS_PLATFORM_H
LEFTRIGHT

Powered by Google App Engine
This is Rietveld