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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 return; | 88 return; |
89 filterEnginePromise = std::make_shared<std::promise<FilterEnginePtr>>(); | 89 filterEnginePromise = std::make_shared<std::promise<FilterEnginePtr>>(); |
90 filterEngine = filterEnginePromise->get_future(); | 90 filterEngine = filterEnginePromise->get_future(); |
91 } | 91 } |
92 | 92 |
93 GetJsEngine(); // ensures that JsEngine is instantiated | 93 GetJsEngine(); // ensures that JsEngine is instantiated |
94 FilterEngine::CreateAsync(jsEngine, [this, onCreated, filterEnginePromise](con
st FilterEnginePtr& filterEngine) | 94 FilterEngine::CreateAsync(jsEngine, [this, onCreated, filterEnginePromise](con
st FilterEnginePtr& filterEngine) |
95 { | 95 { |
96 filterEnginePromise->set_value(filterEngine); | 96 filterEnginePromise->set_value(filterEngine); |
97 if (onCreated) | 97 if (onCreated) |
98 onCreated(filterEngine); | 98 onCreated(*filterEngine); |
99 }, parameters); | 99 }, parameters); |
100 } | 100 } |
101 | 101 |
102 FilterEnginePtr Platform::GetFilterEngine() | 102 FilterEngine& Platform::GetFilterEngine() |
103 { | 103 { |
104 CreateFilterEngineAsync(); | 104 CreateFilterEngineAsync(); |
105 return std::shared_future<FilterEnginePtr>(filterEngine).get(); | 105 return *std::shared_future<FilterEnginePtr>(filterEngine).get(); |
106 } | 106 } |
107 | 107 |
108 ITimer& Platform::GetTimer() | 108 ITimer& Platform::GetTimer() |
109 { | 109 { |
110 return *timer; | 110 return *timer; |
111 } | 111 } |
112 | 112 |
113 IFileSystem& Platform::GetFileSystem() | 113 IFileSystem& Platform::GetFileSystem() |
114 { | 114 { |
115 return *fileSystem; | 115 return *fileSystem; |
116 } | 116 } |
117 | 117 |
118 IWebRequest& Platform::GetWebRequest() | 118 IWebRequest& Platform::GetWebRequest() |
119 { | 119 { |
120 return *webRequest; | 120 return *webRequest; |
121 } | 121 } |
122 | 122 |
123 LogSystem& Platform::GetLogSystem() | 123 LogSystem& Platform::GetLogSystem() |
124 { | 124 { |
125 return *logSystem; | 125 return *logSystem; |
126 } | 126 } |
OLD | NEW |