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

Side by Side Diff: src/Platform.cpp

Issue 29508591: Issue 5450 - don't expose std::shared_ptr<FilterEngine> (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: rebase Created Aug. 7, 2017, 1:08 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 | « shell/src/Main.cpp ('k') | test/BaseJsTest.h » ('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-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
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 }
OLDNEW
« no previous file with comments | « shell/src/Main.cpp ('k') | test/BaseJsTest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld