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

Side by Side Diff: include/AdblockPlus/Platform.h

Issue 29727558: Issue 6489 - fix initialization moment of the default scheduler of DefaultPlatformBuilder (Closed) Base URL: https://github.com/adblockplus/libadblockplus@cd1cd70ea3122fb4b8a96c40d96ce9b1ae5a3ae9
Patch Set: fix typo Created March 19, 2018, 12:33 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/AdblockPlus/AsyncExecutor.h ('k') | src/Platform.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-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 14 matching lines...) Expand all
25 #include "AppInfo.h" 25 #include "AppInfo.h"
26 #include "Scheduler.h" 26 #include "Scheduler.h"
27 #include "FilterEngine.h" 27 #include "FilterEngine.h"
28 #include <mutex> 28 #include <mutex>
29 #include <future> 29 #include <future>
30 30
31 namespace AdblockPlus 31 namespace AdblockPlus
32 { 32 {
33 struct IV8IsolateProvider; 33 struct IV8IsolateProvider;
34 class JsEngine; 34 class JsEngine;
35 class OptionalAsyncExecutor;
35 36
36 /** 37 /**
37 * AdblockPlus platform is the main component providing access to other 38 * AdblockPlus platform is the main component providing access to other
38 * modules. 39 * modules.
39 * 40 *
40 * It manages the functionality modules, e.g. JsEngine and FilterEngine as 41 * It manages the functionality modules, e.g. JsEngine and FilterEngine as
41 * well as allows to correctly work with asynchronous functionality. 42 * well as allows to correctly work with asynchronous functionality.
42 */ 43 */
43 class Platform 44 class Platform
44 { 45 {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 }; 133 };
133 134
134 /** 135 /**
135 * A helper class allowing to construct a default Platform and to obtain 136 * A helper class allowing to construct a default Platform and to obtain
136 * the Scheduler used by Platform before the latter is constructed. 137 * the Scheduler used by Platform before the latter is constructed.
137 */ 138 */
138 class DefaultPlatformBuilder : public Platform::CreationParameters 139 class DefaultPlatformBuilder : public Platform::CreationParameters
139 { 140 {
140 public: 141 public:
141 /** 142 /**
143 * Private
144 */
145 typedef std::shared_ptr<OptionalAsyncExecutor> AsyncExecutorPtr;
146
147 DefaultPlatformBuilder();
148
149 /**
142 * Constructs a default executor for asynchronous tasks. When Platform 150 * Constructs a default executor for asynchronous tasks. When Platform
143 * is being destroyed it starts to ignore new tasks and waits for finishing 151 * is being destroyed it starts to ignore new tasks and waits for finishing
144 * of already running tasks. 152 * of already running tasks.
145 * @return Scheduler allowing to execute tasks asynchronously. 153 * @return Scheduler allowing to execute tasks asynchronously.
146 */ 154 */
147 Scheduler GetDefaultAsyncExecutor(); 155 Scheduler GetDefaultAsyncExecutor();
148 156
149 /** 157 /**
150 * Constructs default implementation of `ITimer`. 158 * Constructs default implementation of `ITimer`.
151 */ 159 */
(...skipping 14 matching lines...) Expand all
166 * Constructs default implementation of `LogSystem`. 174 * Constructs default implementation of `LogSystem`.
167 */ 175 */
168 void CreateDefaultLogSystem(); 176 void CreateDefaultLogSystem();
169 177
170 /** 178 /**
171 * Constructs Platform with default implementations of platform interfaces 179 * Constructs Platform with default implementations of platform interfaces
172 * when a corresponding field is nullptr and with a default Scheduler. 180 * when a corresponding field is nullptr and with a default Scheduler.
173 */ 181 */
174 std::unique_ptr<Platform> CreatePlatform(); 182 std::unique_ptr<Platform> CreatePlatform();
175 private: 183 private:
184 AsyncExecutorPtr sharedAsyncExecutor;
176 Scheduler defaultScheduler; 185 Scheduler defaultScheduler;
177 }; 186 };
178 } 187 }
179 188
180 #endif // ADBLOCK_PLUS_PLATFORM_H 189 #endif // ADBLOCK_PLUS_PLATFORM_H
OLDNEW
« no previous file with comments | « include/AdblockPlus/AsyncExecutor.h ('k') | src/Platform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld