Merge lp:~marcustomlinson/unity-scope-click/lp-1578283-2 into lp:unity-scope-click
- lp-1578283-2
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Paweł Stołowski | ||||
Approved revision: | 447 | ||||
Merged at revision: | 444 | ||||
Proposed branch: | lp:~marcustomlinson/unity-scope-click/lp-1578283-2 | ||||
Merge into: | lp:unity-scope-click | ||||
Diff against target: |
346 lines (+73/-34) 10 files modified
libclickscope/click/preview.cpp (+9/-2) libclickscope/click/preview.h (+3/-1) scope/clickapps/apps-query.cpp (+14/-5) scope/clickapps/apps-query.h (+6/-1) scope/clickapps/apps-scope.cpp (+8/-7) scope/clickapps/apps-scope.h (+5/-4) scope/clickstore/store-query.cpp (+11/-4) scope/clickstore/store-query.h (+4/-1) scope/clickstore/store-scope.cpp (+9/-7) scope/clickstore/store-scope.h (+4/-2) |
||||
To merge this branch: | bzr merge lp:~marcustomlinson/unity-scope-click/lp-1578283-2 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Needs Fixing | |
Paweł Stołowski (community) | Approve | ||
Review via email: mp+294246@code.launchpad.net |
Commit message
Don't block search() and preview() calls while the Qt main loop spins up
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
Paweł Stołowski (stolowski) wrote : | # |
Great job finding out about SSO slowness! As discussed on IRC however, preview() is still affected, because click scope may get killed after displaying search results and then when preview is requested, we hit the same issue you found with search(). I think the only fix is to wait for initialization to complete to run() methods of search and preview query classes.
- 447. By Marcus Tomlinson
-
Wait for qt mainloop initialisation in run() methods rather than search() and preview()
Marcus Tomlinson (marcustomlinson) wrote : | # |
> Great job finding out about SSO slowness! As discussed on IRC however,
> preview() is still affected, because click scope may get killed after
> displaying search results and then when preview is requested, we hit the same
> issue you found with search(). I think the only fix is to wait for
> initialization to complete to run() methods of search and preview query
> classes.
What a mess the diff ended being. Hopefully this does it
Paweł Stołowski (stolowski) wrote : | # |
Looks good! +1
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:447
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'libclickscope/click/preview.cpp' | |||
2 | --- libclickscope/click/preview.cpp 2016-04-01 17:16:05 +0000 | |||
3 | +++ libclickscope/click/preview.cpp 2016-05-10 14:58:44 +0000 | |||
4 | @@ -158,8 +158,12 @@ | |||
5 | 158 | // Preview base class | 158 | // Preview base class |
6 | 159 | 159 | ||
7 | 160 | Preview::Preview(const unity::scopes::Result& result, | 160 | Preview::Preview(const unity::scopes::Result& result, |
10 | 161 | const unity::scopes::ActionMetadata& metadata) | 161 | const unity::scopes::ActionMetadata& metadata, |
11 | 162 | : PreviewQueryBase(result, metadata), result(result), metadata(metadata) | 162 | std::shared_future<void> const& qt_ready) |
12 | 163 | : PreviewQueryBase(result, metadata), | ||
13 | 164 | result(result), | ||
14 | 165 | metadata(metadata), | ||
15 | 166 | qt_ready_(qt_ready) | ||
16 | 163 | { | 167 | { |
17 | 164 | } | 168 | } |
18 | 165 | 169 | ||
19 | @@ -259,6 +263,9 @@ | |||
20 | 259 | 263 | ||
21 | 260 | void Preview::run(const unity::scopes::PreviewReplyProxy &reply) | 264 | void Preview::run(const unity::scopes::PreviewReplyProxy &reply) |
22 | 261 | { | 265 | { |
23 | 266 | if (qt_ready_.valid()) | ||
24 | 267 | qt_ready_.wait(); | ||
25 | 268 | |||
26 | 262 | strategy->run(reply); | 269 | strategy->run(reply); |
27 | 263 | } | 270 | } |
28 | 264 | 271 | ||
29 | 265 | 272 | ||
30 | === modified file 'libclickscope/click/preview.h' | |||
31 | --- libclickscope/click/preview.h 2016-03-07 14:10:27 +0000 | |||
32 | +++ libclickscope/click/preview.h 2016-05-10 14:58:44 +0000 | |||
33 | @@ -102,6 +102,7 @@ | |||
34 | 102 | std::unique_ptr<PreviewStrategy> strategy; | 102 | std::unique_ptr<PreviewStrategy> strategy; |
35 | 103 | const unity::scopes::Result& result; | 103 | const unity::scopes::Result& result; |
36 | 104 | const unity::scopes::ActionMetadata& metadata; | 104 | const unity::scopes::ActionMetadata& metadata; |
37 | 105 | std::shared_future<void> qt_ready_; | ||
38 | 105 | PreviewStrategy* build_strategy(const unity::scopes::Result& result, | 106 | PreviewStrategy* build_strategy(const unity::scopes::Result& result, |
39 | 106 | const unity::scopes::ActionMetadata& metadata, | 107 | const unity::scopes::ActionMetadata& metadata, |
40 | 107 | const QSharedPointer<web::Client> &client, | 108 | const QSharedPointer<web::Client> &client, |
41 | @@ -142,7 +143,8 @@ | |||
42 | 142 | 143 | ||
43 | 143 | Preview(const unity::scopes::Result& result); | 144 | Preview(const unity::scopes::Result& result); |
44 | 144 | Preview(const unity::scopes::Result& result, | 145 | Preview(const unity::scopes::Result& result, |
46 | 145 | const unity::scopes::ActionMetadata& metadata); | 146 | const unity::scopes::ActionMetadata& metadata, |
47 | 147 | std::shared_future<void> const& qt_ready = std::future<void>()); | ||
48 | 146 | virtual ~Preview(); | 148 | virtual ~Preview(); |
49 | 147 | void choose_strategy(const QSharedPointer<web::Client> &client, | 149 | void choose_strategy(const QSharedPointer<web::Client> &client, |
50 | 148 | const QSharedPointer<pay::Package>& ppackage, | 150 | const QSharedPointer<pay::Package>& ppackage, |
51 | 149 | 151 | ||
52 | === modified file 'scope/clickapps/apps-query.cpp' | |||
53 | --- scope/clickapps/apps-query.cpp 2016-03-09 11:01:19 +0000 | |||
54 | +++ scope/clickapps/apps-query.cpp 2016-05-10 14:58:44 +0000 | |||
55 | @@ -222,21 +222,27 @@ | |||
56 | 222 | 222 | ||
57 | 223 | struct click::apps::Query::Private | 223 | struct click::apps::Query::Private |
58 | 224 | { | 224 | { |
60 | 225 | Private(std::shared_ptr<click::DepartmentsDb> depts_db, const scopes::SearchMetadata& metadata) | 225 | Private(std::shared_ptr<click::DepartmentsDb> depts_db, |
61 | 226 | const scopes::SearchMetadata& metadata, | ||
62 | 227 | std::shared_future<void> const& qt_ready) | ||
63 | 226 | : depts_db(depts_db), | 228 | : depts_db(depts_db), |
65 | 227 | meta(metadata) | 229 | meta(metadata), |
66 | 230 | qt_ready_(qt_ready) | ||
67 | 228 | { | 231 | { |
68 | 229 | } | 232 | } |
69 | 230 | 233 | ||
70 | 231 | std::shared_ptr<click::DepartmentsDb> depts_db; | 234 | std::shared_ptr<click::DepartmentsDb> depts_db; |
71 | 232 | scopes::SearchMetadata meta; | 235 | scopes::SearchMetadata meta; |
72 | 233 | click::Configuration configuration; | 236 | click::Configuration configuration; |
73 | 237 | std::shared_future<void> qt_ready_; | ||
74 | 234 | }; | 238 | }; |
75 | 235 | 239 | ||
78 | 236 | click::apps::Query::Query(unity::scopes::CannedQuery const& query, std::shared_ptr<DepartmentsDb> depts_db, | 240 | click::apps::Query::Query(unity::scopes::CannedQuery const& query, |
79 | 237 | scopes::SearchMetadata const& metadata) | 241 | std::shared_ptr<DepartmentsDb> depts_db, |
80 | 242 | scopes::SearchMetadata const& metadata, | ||
81 | 243 | std::shared_future<void> const& qt_ready) | ||
82 | 238 | : unity::scopes::SearchQueryBase(query, metadata), | 244 | : unity::scopes::SearchQueryBase(query, metadata), |
84 | 239 | impl(new Private(depts_db, metadata)) | 245 | impl(new Private(depts_db, metadata, qt_ready)) |
85 | 240 | { | 246 | { |
86 | 241 | } | 247 | } |
87 | 242 | 248 | ||
88 | @@ -403,6 +409,9 @@ | |||
89 | 403 | 409 | ||
90 | 404 | void click::apps::Query::run(scopes::SearchReplyProxy const& searchReply) | 410 | void click::apps::Query::run(scopes::SearchReplyProxy const& searchReply) |
91 | 405 | { | 411 | { |
92 | 412 | if (impl->qt_ready_.valid()) | ||
93 | 413 | impl->qt_ready_.wait(); | ||
94 | 414 | |||
95 | 406 | const std::string categoryTemplate = CATEGORY_APPS_DISPLAY; | 415 | const std::string categoryTemplate = CATEGORY_APPS_DISPLAY; |
96 | 407 | auto const current_dept = query().department_id(); | 416 | auto const current_dept = query().department_id(); |
97 | 408 | auto const querystr = query().query_string(); | 417 | auto const querystr = query().query_string(); |
98 | 409 | 418 | ||
99 | === modified file 'scope/clickapps/apps-query.h' | |||
100 | --- scope/clickapps/apps-query.h 2014-08-19 18:21:14 +0000 | |||
101 | +++ scope/clickapps/apps-query.h 2016-05-10 14:58:44 +0000 | |||
102 | @@ -40,6 +40,8 @@ | |||
103 | 40 | #include <unordered_set> | 40 | #include <unordered_set> |
104 | 41 | #include <click/interface.h> | 41 | #include <click/interface.h> |
105 | 42 | 42 | ||
106 | 43 | #include <future> | ||
107 | 44 | |||
108 | 43 | namespace click | 45 | namespace click |
109 | 44 | { | 46 | { |
110 | 45 | 47 | ||
111 | @@ -64,7 +66,10 @@ | |||
112 | 64 | constexpr static const char* VERSION{"version"}; | 66 | constexpr static const char* VERSION{"version"}; |
113 | 65 | }; | 67 | }; |
114 | 66 | 68 | ||
116 | 67 | Query(unity::scopes::CannedQuery const& query, std::shared_ptr<DepartmentsDb> depts_db, scopes::SearchMetadata const& metadata); | 69 | Query(unity::scopes::CannedQuery const& query, |
117 | 70 | std::shared_ptr<DepartmentsDb> depts_db, | ||
118 | 71 | scopes::SearchMetadata const& metadata, | ||
119 | 72 | std::shared_future<void> const& qt_ready = std::future<void>()); | ||
120 | 68 | virtual ~Query(); | 73 | virtual ~Query(); |
121 | 69 | 74 | ||
122 | 70 | virtual void cancelled() override; | 75 | virtual void cancelled() override; |
123 | 71 | 76 | ||
124 | === modified file 'scope/clickapps/apps-scope.cpp' | |||
125 | --- scope/clickapps/apps-scope.cpp 2016-04-15 09:24:18 +0000 | |||
126 | +++ scope/clickapps/apps-scope.cpp 2016-05-10 14:58:44 +0000 | |||
127 | @@ -49,7 +49,8 @@ | |||
128 | 49 | 49 | ||
129 | 50 | click::Scope::Scope() | 50 | click::Scope::Scope() |
130 | 51 | { | 51 | { |
132 | 52 | qt_ready_f = qt_ready_p.get_future(); | 52 | qt_ready_for_search_f = qt_ready_for_search_p.get_future(); |
133 | 53 | qt_ready_for_preview_f = qt_ready_for_preview_p.get_future(); | ||
134 | 53 | nam.reset(new click::network::AccessManager()); | 54 | nam.reset(new click::network::AccessManager()); |
135 | 54 | client.reset(new click::web::Client(nam)); | 55 | client.reset(new click::web::Client(nam)); |
136 | 55 | index.reset(new click::Index(client)); | 56 | index.reset(new click::Index(client)); |
137 | @@ -82,10 +83,12 @@ | |||
138 | 82 | static const int zero = 0; | 83 | static const int zero = 0; |
139 | 83 | auto emptyCb = [this]() | 84 | auto emptyCb = [this]() |
140 | 84 | { | 85 | { |
141 | 86 | dm.reset(Ubuntu::DownloadManager::Manager::createSessionManager()); | ||
142 | 87 | qt_ready_for_search_p.set_value(); | ||
143 | 88 | |||
144 | 85 | sso.reset(new click::CredentialsService()); | 89 | sso.reset(new click::CredentialsService()); |
145 | 86 | client->setCredentialsService(sso); | 90 | client->setCredentialsService(sso); |
148 | 87 | dm.reset(Ubuntu::DownloadManager::Manager::createSessionManager()); | 91 | qt_ready_for_preview_p.set_value(); |
147 | 88 | qt_ready_p.set_value(); | ||
149 | 89 | }; | 92 | }; |
150 | 90 | 93 | ||
151 | 91 | qt::core::world::build_and_run(zero, nullptr, emptyCb); | 94 | qt::core::world::build_and_run(zero, nullptr, emptyCb); |
152 | @@ -98,16 +101,14 @@ | |||
153 | 98 | 101 | ||
154 | 99 | scopes::SearchQueryBase::UPtr click::Scope::search(unity::scopes::CannedQuery const& q, scopes::SearchMetadata const& metadata) | 102 | scopes::SearchQueryBase::UPtr click::Scope::search(unity::scopes::CannedQuery const& q, scopes::SearchMetadata const& metadata) |
155 | 100 | { | 103 | { |
158 | 101 | qt_ready_f.wait(); | 104 | return scopes::SearchQueryBase::UPtr(new click::apps::Query(q, depts_db, metadata, qt_ready_for_search_f.share())); |
157 | 102 | return scopes::SearchQueryBase::UPtr(new click::apps::Query(q, depts_db, metadata)); | ||
159 | 103 | } | 105 | } |
160 | 104 | 106 | ||
161 | 105 | 107 | ||
162 | 106 | unity::scopes::PreviewQueryBase::UPtr click::Scope::preview(const unity::scopes::Result& result, | 108 | unity::scopes::PreviewQueryBase::UPtr click::Scope::preview(const unity::scopes::Result& result, |
163 | 107 | const unity::scopes::ActionMetadata& metadata) { | 109 | const unity::scopes::ActionMetadata& metadata) { |
164 | 108 | qt_ready_f.wait(); | ||
165 | 109 | qDebug() << "Scope::preview() called."; | 110 | qDebug() << "Scope::preview() called."; |
167 | 110 | auto preview = new click::Preview(result, metadata); | 111 | auto preview = new click::Preview(result, metadata, qt_ready_for_preview_f.share()); |
168 | 111 | preview->choose_strategy(client, pay_package, dm, depts_db); | 112 | preview->choose_strategy(client, pay_package, dm, depts_db); |
169 | 112 | return unity::scopes::PreviewQueryBase::UPtr{preview}; | 113 | return unity::scopes::PreviewQueryBase::UPtr{preview}; |
170 | 113 | } | 114 | } |
171 | 114 | 115 | ||
172 | === modified file 'scope/clickapps/apps-scope.h' | |||
173 | --- scope/clickapps/apps-scope.h 2016-04-15 09:24:18 +0000 | |||
174 | +++ scope/clickapps/apps-scope.h 2016-05-10 14:58:44 +0000 | |||
175 | @@ -30,8 +30,6 @@ | |||
176 | 30 | #ifndef APPS_SCOPE_H | 30 | #ifndef APPS_SCOPE_H |
177 | 31 | #define APPS_SCOPE_H | 31 | #define APPS_SCOPE_H |
178 | 32 | 32 | ||
179 | 33 | #include <future> | ||
180 | 34 | |||
181 | 35 | #include <click/index.h> | 33 | #include <click/index.h> |
182 | 36 | #include <click/network_access_manager.h> | 34 | #include <click/network_access_manager.h> |
183 | 37 | #include <click/pay.h> | 35 | #include <click/pay.h> |
184 | @@ -42,6 +40,7 @@ | |||
185 | 42 | #include <unity/scopes/QueryBase.h> | 40 | #include <unity/scopes/QueryBase.h> |
186 | 43 | #include <unity/scopes/ActivationQueryBase.h> | 41 | #include <unity/scopes/ActivationQueryBase.h> |
187 | 44 | 42 | ||
188 | 43 | #include <future> | ||
189 | 45 | 44 | ||
190 | 46 | namespace scopes = unity::scopes; | 45 | namespace scopes = unity::scopes; |
191 | 47 | 46 | ||
192 | @@ -68,8 +67,10 @@ | |||
193 | 68 | virtual unity::scopes::ActivationQueryBase::UPtr perform_action(unity::scopes::Result const& result, unity::scopes::ActionMetadata const& metadata, std::string const& widget_id, std::string const& action_id) override; | 67 | virtual unity::scopes::ActivationQueryBase::UPtr perform_action(unity::scopes::Result const& result, unity::scopes::ActionMetadata const& metadata, std::string const& widget_id, std::string const& action_id) override; |
194 | 69 | 68 | ||
195 | 70 | private: | 69 | private: |
198 | 71 | std::promise<void> qt_ready_p; | 70 | std::promise<void> qt_ready_for_search_p; |
199 | 72 | std::future<void> qt_ready_f; | 71 | std::future<void> qt_ready_for_search_f; |
200 | 72 | std::promise<void> qt_ready_for_preview_p; | ||
201 | 73 | std::future<void> qt_ready_for_preview_f; | ||
202 | 73 | QSharedPointer<click::network::AccessManager> nam; | 74 | QSharedPointer<click::network::AccessManager> nam; |
203 | 74 | QSharedPointer<click::web::Client> client; | 75 | QSharedPointer<click::web::Client> client; |
204 | 75 | QSharedPointer<click::Index> index; | 76 | QSharedPointer<click::Index> index; |
205 | 76 | 77 | ||
206 | === modified file 'scope/clickstore/store-query.cpp' | |||
207 | --- scope/clickstore/store-query.cpp 2016-01-12 10:23:19 +0000 | |||
208 | +++ scope/clickstore/store-query.cpp 2016-05-10 14:58:44 +0000 | |||
209 | @@ -152,13 +152,15 @@ | |||
210 | 152 | std::shared_ptr<click::DepartmentsDb> depts_db, | 152 | std::shared_ptr<click::DepartmentsDb> depts_db, |
211 | 153 | click::HighlightList& highlights, | 153 | click::HighlightList& highlights, |
212 | 154 | const scopes::SearchMetadata& metadata, | 154 | const scopes::SearchMetadata& metadata, |
214 | 155 | pay::Package& in_package) | 155 | pay::Package& in_package, |
215 | 156 | std::shared_future<void> const& qt_ready) | ||
216 | 156 | : index(index), | 157 | : index(index), |
217 | 157 | department_lookup(depts), | 158 | department_lookup(depts), |
218 | 158 | depts_db(depts_db), | 159 | depts_db(depts_db), |
219 | 159 | highlights(highlights), | 160 | highlights(highlights), |
220 | 160 | meta(metadata), | 161 | meta(metadata), |
222 | 161 | pay_package(in_package) | 162 | pay_package(in_package), |
223 | 163 | qt_ready_(qt_ready) | ||
224 | 162 | { | 164 | { |
225 | 163 | } | 165 | } |
226 | 164 | click::Index& index; | 166 | click::Index& index; |
227 | @@ -169,6 +171,7 @@ | |||
228 | 169 | click::web::Cancellable search_operation; | 171 | click::web::Cancellable search_operation; |
229 | 170 | click::web::Cancellable purchases_operation; | 172 | click::web::Cancellable purchases_operation; |
230 | 171 | pay::Package& pay_package; | 173 | pay::Package& pay_package; |
231 | 174 | std::shared_future<void> qt_ready_; | ||
232 | 172 | }; | 175 | }; |
233 | 173 | 176 | ||
234 | 174 | click::Query::Query(unity::scopes::CannedQuery const& query, | 177 | click::Query::Query(unity::scopes::CannedQuery const& query, |
235 | @@ -177,9 +180,10 @@ | |||
236 | 177 | std::shared_ptr<click::DepartmentsDb> depts_db, | 180 | std::shared_ptr<click::DepartmentsDb> depts_db, |
237 | 178 | click::HighlightList& highlights, | 181 | click::HighlightList& highlights, |
238 | 179 | scopes::SearchMetadata const& metadata, | 182 | scopes::SearchMetadata const& metadata, |
240 | 180 | pay::Package& in_package) | 183 | pay::Package& in_package, |
241 | 184 | std::shared_future<void> const& qt_ready) | ||
242 | 181 | : unity::scopes::SearchQueryBase(query, metadata), | 185 | : unity::scopes::SearchQueryBase(query, metadata), |
244 | 182 | impl(new Private(index, depts, depts_db, highlights, metadata, in_package)) | 186 | impl(new Private(index, depts, depts_db, highlights, metadata, in_package, qt_ready)) |
245 | 183 | { | 187 | { |
246 | 184 | } | 188 | } |
247 | 185 | 189 | ||
248 | @@ -614,6 +618,9 @@ | |||
249 | 614 | 618 | ||
250 | 615 | void click::Query::run(scopes::SearchReplyProxy const& searchReply) | 619 | void click::Query::run(scopes::SearchReplyProxy const& searchReply) |
251 | 616 | { | 620 | { |
252 | 621 | if (impl->qt_ready_.valid()) | ||
253 | 622 | impl->qt_ready_.wait(); | ||
254 | 623 | |||
255 | 617 | auto q = query().query_string(); | 624 | auto q = query().query_string(); |
256 | 618 | std::string categoryTemplate = CATEGORY_APPS_SEARCH; | 625 | std::string categoryTemplate = CATEGORY_APPS_SEARCH; |
257 | 619 | if (q.empty()) { | 626 | if (q.empty()) { |
258 | 620 | 627 | ||
259 | === modified file 'scope/clickstore/store-query.h' | |||
260 | --- scope/clickstore/store-query.h 2015-12-01 15:39:41 +0000 | |||
261 | +++ scope/clickstore/store-query.h 2016-05-10 14:58:44 +0000 | |||
262 | @@ -44,6 +44,8 @@ | |||
263 | 44 | #include <click/highlights.h> | 44 | #include <click/highlights.h> |
264 | 45 | #include <click/interface.h> | 45 | #include <click/interface.h> |
265 | 46 | 46 | ||
266 | 47 | #include <future> | ||
267 | 48 | |||
268 | 47 | namespace click | 49 | namespace click |
269 | 48 | { | 50 | { |
270 | 49 | 51 | ||
271 | @@ -74,7 +76,8 @@ | |||
272 | 74 | std::shared_ptr<click::DepartmentsDb> depts_db, | 76 | std::shared_ptr<click::DepartmentsDb> depts_db, |
273 | 75 | click::HighlightList& highlights, | 77 | click::HighlightList& highlights, |
274 | 76 | scopes::SearchMetadata const& metadata, | 78 | scopes::SearchMetadata const& metadata, |
276 | 77 | pay::Package& in_package); | 79 | pay::Package& in_package, |
277 | 80 | std::shared_future<void> const& qt_ready = std::future<void>()); | ||
278 | 78 | virtual ~Query(); | 81 | virtual ~Query(); |
279 | 79 | 82 | ||
280 | 80 | virtual void cancelled() override; | 83 | virtual void cancelled() override; |
281 | 81 | 84 | ||
282 | === modified file 'scope/clickstore/store-scope.cpp' | |||
283 | --- scope/clickstore/store-scope.cpp 2016-04-15 09:24:18 +0000 | |||
284 | +++ scope/clickstore/store-scope.cpp 2016-05-10 14:58:44 +0000 | |||
285 | @@ -47,7 +47,8 @@ | |||
286 | 47 | 47 | ||
287 | 48 | click::Scope::Scope() | 48 | click::Scope::Scope() |
288 | 49 | { | 49 | { |
290 | 50 | qt_ready_f = qt_ready_p.get_future(); | 50 | qt_ready_for_search_f = qt_ready_for_search_p.get_future(); |
291 | 51 | qt_ready_for_preview_f = qt_ready_for_preview_p.get_future(); | ||
292 | 51 | nam.reset(new click::network::AccessManager()); | 52 | nam.reset(new click::network::AccessManager()); |
293 | 52 | client.reset(new click::web::Client(nam)); | 53 | client.reset(new click::web::Client(nam)); |
294 | 53 | index.reset(new click::Index(client)); | 54 | index.reset(new click::Index(client)); |
295 | @@ -84,10 +85,12 @@ | |||
296 | 84 | static const int zero = 0; | 85 | static const int zero = 0; |
297 | 85 | auto emptyCb = [this]() | 86 | auto emptyCb = [this]() |
298 | 86 | { | 87 | { |
299 | 88 | dm.reset(Ubuntu::DownloadManager::Manager::createSessionManager()); | ||
300 | 89 | qt_ready_for_search_p.set_value(); | ||
301 | 90 | |||
302 | 87 | sso.reset(new click::CredentialsService()); | 91 | sso.reset(new click::CredentialsService()); |
303 | 88 | client->setCredentialsService(sso); | 92 | client->setCredentialsService(sso); |
306 | 89 | dm.reset(Ubuntu::DownloadManager::Manager::createSessionManager()); | 93 | qt_ready_for_preview_p.set_value(); |
305 | 90 | qt_ready_p.set_value(); | ||
307 | 91 | }; | 94 | }; |
308 | 92 | 95 | ||
309 | 93 | qt::core::world::build_and_run(zero, nullptr, emptyCb); | 96 | qt::core::world::build_and_run(zero, nullptr, emptyCb); |
310 | @@ -100,16 +103,15 @@ | |||
311 | 100 | 103 | ||
312 | 101 | scopes::SearchQueryBase::UPtr click::Scope::search(unity::scopes::CannedQuery const& q, scopes::SearchMetadata const& metadata) | 104 | scopes::SearchQueryBase::UPtr click::Scope::search(unity::scopes::CannedQuery const& q, scopes::SearchMetadata const& metadata) |
313 | 102 | { | 105 | { |
316 | 103 | qt_ready_f.wait(); | 106 | return scopes::SearchQueryBase::UPtr(new click::Query(q, *index, *depts, depts_db, *highlights, metadata, |
317 | 104 | return scopes::SearchQueryBase::UPtr(new click::Query(q, *index, *depts, depts_db, *highlights, metadata, *pay_package)); | 107 | *pay_package, qt_ready_for_search_f.share())); |
318 | 105 | } | 108 | } |
319 | 106 | 109 | ||
320 | 107 | 110 | ||
321 | 108 | unity::scopes::PreviewQueryBase::UPtr click::Scope::preview(const unity::scopes::Result& result, | 111 | unity::scopes::PreviewQueryBase::UPtr click::Scope::preview(const unity::scopes::Result& result, |
322 | 109 | const unity::scopes::ActionMetadata& metadata) { | 112 | const unity::scopes::ActionMetadata& metadata) { |
323 | 110 | qt_ready_f.wait(); | ||
324 | 111 | qDebug() << "Scope::preview() called."; | 113 | qDebug() << "Scope::preview() called."; |
326 | 112 | auto preview = new click::Preview(result, metadata); | 114 | auto preview = new click::Preview(result, metadata, qt_ready_for_preview_f.share()); |
327 | 113 | preview->choose_strategy(client, pay_package, dm, depts_db); | 115 | preview->choose_strategy(client, pay_package, dm, depts_db); |
328 | 114 | return unity::scopes::PreviewQueryBase::UPtr{preview}; | 116 | return unity::scopes::PreviewQueryBase::UPtr{preview}; |
329 | 115 | } | 117 | } |
330 | 116 | 118 | ||
331 | === modified file 'scope/clickstore/store-scope.h' | |||
332 | --- scope/clickstore/store-scope.h 2016-04-15 09:24:18 +0000 | |||
333 | +++ scope/clickstore/store-scope.h 2016-05-10 14:58:44 +0000 | |||
334 | @@ -71,8 +71,10 @@ | |||
335 | 71 | virtual unity::scopes::ActivationQueryBase::UPtr perform_action(unity::scopes::Result const& result, unity::scopes::ActionMetadata const& metadata, std::string const& widget_id, std::string const& action_id) override; | 71 | virtual unity::scopes::ActivationQueryBase::UPtr perform_action(unity::scopes::Result const& result, unity::scopes::ActionMetadata const& metadata, std::string const& widget_id, std::string const& action_id) override; |
336 | 72 | 72 | ||
337 | 73 | private: | 73 | private: |
340 | 74 | std::promise<void> qt_ready_p; | 74 | std::promise<void> qt_ready_for_search_p; |
341 | 75 | std::future<void> qt_ready_f; | 75 | std::future<void> qt_ready_for_search_f; |
342 | 76 | std::promise<void> qt_ready_for_preview_p; | ||
343 | 77 | std::future<void> qt_ready_for_preview_f; | ||
344 | 76 | QSharedPointer<click::network::AccessManager> nam; | 78 | QSharedPointer<click::network::AccessManager> nam; |
345 | 77 | QSharedPointer<click::web::Client> client; | 79 | QSharedPointer<click::web::Client> client; |
346 | 78 | QSharedPointer<click::Index> index; | 80 | QSharedPointer<click::Index> index; |
FAILED: Continuous integration, rev:446 jenkins. qa.ubuntu. com/job/ unity-scope- click-ci/ 743/ jenkins. qa.ubuntu. com/job/ unity-scope- click-wily- amd64-ci/ 147/console jenkins. qa.ubuntu. com/job/ unity-scope- click-wily- armhf-ci/ 143/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- scope-click- ci/743/ rebuild
http://