OLD | NEW |
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 19 matching lines...) Expand all Loading... |
30 { | 30 { |
31 std::thread(task).detach(); | 31 std::thread(task).detach(); |
32 } | 32 } |
33 } | 33 } |
34 | 34 |
35 TimerPtr AdblockPlus::CreateDefaultTimer() | 35 TimerPtr AdblockPlus::CreateDefaultTimer() |
36 { | 36 { |
37 return TimerPtr(new DefaultTimer()); | 37 return TimerPtr(new DefaultTimer()); |
38 } | 38 } |
39 | 39 |
40 FileSystemPtr AdblockPlus::CreateDefaultFileSystem(const Scheduler& scheduler) | 40 FileSystemPtr AdblockPlus::CreateDefaultFileSystem(const Scheduler& scheduler, c
onst std::string& basePath) |
41 { | 41 { |
42 return FileSystemPtr(new DefaultFileSystem(scheduler, std::unique_ptr<DefaultF
ileSystemSync>(new DefaultFileSystemSync()))); | 42 return FileSystemPtr(new DefaultFileSystem(scheduler, std::unique_ptr<DefaultF
ileSystemSync>(new DefaultFileSystemSync(basePath)))); |
43 } | 43 } |
44 | 44 |
45 WebRequestPtr AdblockPlus::CreateDefaultWebRequest(const Scheduler& scheduler) | 45 WebRequestPtr AdblockPlus::CreateDefaultWebRequest(const Scheduler& scheduler, W
ebRequestSyncPtr syncImpl) |
46 { | 46 { |
47 return WebRequestPtr(new DefaultWebRequest(scheduler, std::unique_ptr<DefaultW
ebRequestSync>(new DefaultWebRequestSync()))); | 47 if (!syncImpl) |
| 48 syncImpl.reset(new DefaultWebRequestSync()); |
| 49 return WebRequestPtr(new DefaultWebRequest(scheduler, std::move(syncImpl))); |
48 } | 50 } |
49 | 51 |
50 LogSystemPtr AdblockPlus::CreateDefaultLogSystem() | 52 LogSystemPtr AdblockPlus::CreateDefaultLogSystem() |
51 { | 53 { |
52 return LogSystemPtr(new DefaultLogSystem()); | 54 return LogSystemPtr(new DefaultLogSystem()); |
53 } | 55 } |
54 | 56 |
55 Platform::Platform(CreationParameters&& creationParameters) | 57 Platform::Platform(CreationParameters&& creationParameters) |
56 { | 58 { |
57 logSystem = creationParameters.logSystem ? std::move(creationParameters.logSys
tem) : CreateDefaultLogSystem(); | 59 logSystem = creationParameters.logSystem ? std::move(creationParameters.logSys
tem) : CreateDefaultLogSystem(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 119 |
118 IWebRequest& Platform::GetWebRequest() | 120 IWebRequest& Platform::GetWebRequest() |
119 { | 121 { |
120 return *webRequest; | 122 return *webRequest; |
121 } | 123 } |
122 | 124 |
123 LogSystem& Platform::GetLogSystem() | 125 LogSystem& Platform::GetLogSystem() |
124 { | 126 { |
125 return *logSystem; | 127 return *logSystem; |
126 } | 128 } |
OLD | NEW |