Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: content/browser/service_worker/service_worker_client_utils.cc

Issue 2905593002: Clients.matchAll() should return ordered clients by type/focus time/creation time (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_provider_host.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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/service_worker_client_utils.h" 5 #include "content/browser/service_worker/service_worker_client_utils.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <tuple> 8 #include <tuple>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 int frame_tree_node_id_; 96 int frame_tree_node_id_;
97 const OpenURLCallback callback_; 97 const OpenURLCallback callback_;
98 98
99 DISALLOW_COPY_AND_ASSIGN(OpenURLObserver); 99 DISALLOW_COPY_AND_ASSIGN(OpenURLObserver);
100 }; 100 };
101 101
102 ServiceWorkerClientInfo GetWindowClientInfoOnUI( 102 ServiceWorkerClientInfo GetWindowClientInfoOnUI(
103 int render_process_id, 103 int render_process_id,
104 int render_frame_id, 104 int render_frame_id,
105 base::TimeTicks create_time,
105 const std::string& client_uuid) { 106 const std::string& client_uuid) {
106 DCHECK_CURRENTLY_ON(BrowserThread::UI); 107 DCHECK_CURRENTLY_ON(BrowserThread::UI);
107 RenderFrameHostImpl* render_frame_host = 108 RenderFrameHostImpl* render_frame_host =
108 RenderFrameHostImpl::FromID(render_process_id, render_frame_id); 109 RenderFrameHostImpl::FromID(render_process_id, render_frame_id);
109 if (!render_frame_host) 110 if (!render_frame_host)
110 return ServiceWorkerClientInfo(); 111 return ServiceWorkerClientInfo();
111 112
112 // TODO(mlamouri,michaeln): it is possible to end up collecting information 113 // TODO(mlamouri,michaeln): it is possible to end up collecting information
113 // for a frame that is actually being navigated and isn't exactly what we are 114 // for a frame that is actually being navigated and isn't exactly what we are
114 // expecting. 115 // expecting.
115 return ServiceWorkerClientInfo( 116 return ServiceWorkerClientInfo(
116 client_uuid, render_frame_host->GetVisibilityState(), 117 client_uuid, render_frame_host->GetVisibilityState(),
117 render_frame_host->IsFocused(), render_frame_host->GetLastCommittedURL(), 118 render_frame_host->IsFocused(), render_frame_host->GetLastCommittedURL(),
118 render_frame_host->GetParent() ? REQUEST_CONTEXT_FRAME_TYPE_NESTED 119 render_frame_host->GetParent() ? REQUEST_CONTEXT_FRAME_TYPE_NESTED
119 : REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL, 120 : REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL,
120 render_frame_host->frame_tree_node()->last_focus_time(), 121 render_frame_host->frame_tree_node()->last_focus_time(), create_time,
121 blink::kWebServiceWorkerClientTypeWindow); 122 blink::kWebServiceWorkerClientTypeWindow);
122 } 123 }
123 124
124 ServiceWorkerClientInfo FocusOnUI(int render_process_id, 125 ServiceWorkerClientInfo FocusOnUI(int render_process_id,
125 int render_frame_id, 126 int render_frame_id,
127 base::TimeTicks create_time,
126 const std::string& client_uuid) { 128 const std::string& client_uuid) {
127 DCHECK_CURRENTLY_ON(BrowserThread::UI); 129 DCHECK_CURRENTLY_ON(BrowserThread::UI);
128 RenderFrameHostImpl* render_frame_host = 130 RenderFrameHostImpl* render_frame_host =
129 RenderFrameHostImpl::FromID(render_process_id, render_frame_id); 131 RenderFrameHostImpl::FromID(render_process_id, render_frame_id);
130 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( 132 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(
131 WebContents::FromRenderFrameHost(render_frame_host)); 133 WebContents::FromRenderFrameHost(render_frame_host));
132 134
133 if (!render_frame_host || !web_contents) 135 if (!render_frame_host || !web_contents)
134 return ServiceWorkerClientInfo(); 136 return ServiceWorkerClientInfo();
135 137
136 FrameTreeNode* frame_tree_node = render_frame_host->frame_tree_node(); 138 FrameTreeNode* frame_tree_node = render_frame_host->frame_tree_node();
137 139
138 // Focus the frame in the frame tree node, in case it has changed. 140 // Focus the frame in the frame tree node, in case it has changed.
139 frame_tree_node->frame_tree()->SetFocusedFrame( 141 frame_tree_node->frame_tree()->SetFocusedFrame(
140 frame_tree_node, render_frame_host->GetSiteInstance()); 142 frame_tree_node, render_frame_host->GetSiteInstance());
141 143
142 // Focus the frame's view to make sure the frame is now considered as focused. 144 // Focus the frame's view to make sure the frame is now considered as focused.
143 render_frame_host->GetView()->Focus(); 145 render_frame_host->GetView()->Focus();
144 146
145 // Move the web contents to the foreground. 147 // Move the web contents to the foreground.
146 web_contents->Activate(); 148 web_contents->Activate();
147 149
148 return GetWindowClientInfoOnUI(render_process_id, render_frame_id, 150 return GetWindowClientInfoOnUI(render_process_id, render_frame_id,
149 client_uuid); 151 create_time, client_uuid);
150 } 152 }
151 153
152 // This is only called for main frame navigations in OpenWindowOnUI(). 154 // This is only called for main frame navigations in OpenWindowOnUI().
153 void DidOpenURLOnUI(const OpenURLCallback& callback, 155 void DidOpenURLOnUI(const OpenURLCallback& callback,
154 WebContents* web_contents) { 156 WebContents* web_contents) {
155 DCHECK_CURRENTLY_ON(BrowserThread::UI); 157 DCHECK_CURRENTLY_ON(BrowserThread::UI);
156 158
157 if (!web_contents) { 159 if (!web_contents) {
158 BrowserThread::PostTask( 160 BrowserThread::PostTask(
159 BrowserThread::IO, FROM_HERE, 161 BrowserThread::IO, FROM_HERE,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 context->GetClientProviderHostIterator(origin); 269 context->GetClientProviderHostIterator(origin);
268 !it->IsAtEnd(); it->Advance()) { 270 !it->IsAtEnd(); it->Advance()) {
269 ServiceWorkerProviderHost* provider_host = it->GetProviderHost(); 271 ServiceWorkerProviderHost* provider_host = it->GetProviderHost();
270 if (provider_host->process_id() != render_process_id || 272 if (provider_host->process_id() != render_process_id ||
271 provider_host->frame_id() != render_frame_id) { 273 provider_host->frame_id() != render_frame_id) {
272 continue; 274 continue;
273 } 275 }
274 BrowserThread::PostTaskAndReplyWithResult( 276 BrowserThread::PostTaskAndReplyWithResult(
275 BrowserThread::UI, FROM_HERE, 277 BrowserThread::UI, FROM_HERE,
276 base::Bind(&GetWindowClientInfoOnUI, provider_host->process_id(), 278 base::Bind(&GetWindowClientInfoOnUI, provider_host->process_id(),
277 provider_host->route_id(), provider_host->client_uuid()), 279 provider_host->route_id(), provider_host->create_time(),
280 provider_host->client_uuid()),
278 base::Bind(callback, SERVICE_WORKER_OK)); 281 base::Bind(callback, SERVICE_WORKER_OK));
279 return; 282 return;
280 } 283 }
281 284
282 // If here, it means that no provider_host was found, in which case, the 285 // If here, it means that no provider_host was found, in which case, the
283 // renderer should still be informed that the window was opened. 286 // renderer should still be informed that the window was opened.
284 callback.Run(SERVICE_WORKER_OK, ServiceWorkerClientInfo()); 287 callback.Run(SERVICE_WORKER_OK, ServiceWorkerClientInfo());
285 } 288 }
286 289
287 void AddWindowClient( 290 void AddWindowClient(
288 ServiceWorkerProviderHost* host, 291 ServiceWorkerProviderHost* host,
289 std::vector<std::tuple<int, int, std::string>>* client_info) { 292 std::vector<std::tuple<int, int, base::TimeTicks, std::string>>*
293 client_info) {
290 DCHECK_CURRENTLY_ON(BrowserThread::IO); 294 DCHECK_CURRENTLY_ON(BrowserThread::IO);
291 if (host->client_type() != blink::kWebServiceWorkerClientTypeWindow) 295 if (host->client_type() != blink::kWebServiceWorkerClientTypeWindow)
292 return; 296 return;
293 client_info->push_back(std::make_tuple(host->process_id(), host->frame_id(), 297 client_info->push_back(std::make_tuple(host->process_id(), host->frame_id(),
298 host->create_time(),
294 host->client_uuid())); 299 host->client_uuid()));
295 } 300 }
296 301
297 void AddNonWindowClient(ServiceWorkerProviderHost* host, 302 void AddNonWindowClient(ServiceWorkerProviderHost* host,
298 const ServiceWorkerClientQueryOptions& options, 303 const ServiceWorkerClientQueryOptions& options,
299 ServiceWorkerClients* clients) { 304 ServiceWorkerClients* clients) {
300 DCHECK_CURRENTLY_ON(BrowserThread::IO); 305 DCHECK_CURRENTLY_ON(BrowserThread::IO);
301 blink::WebServiceWorkerClientType host_client_type = host->client_type(); 306 blink::WebServiceWorkerClientType host_client_type = host->client_type();
302 if (host_client_type == blink::kWebServiceWorkerClientTypeWindow) 307 if (host_client_type == blink::kWebServiceWorkerClientTypeWindow)
303 return; 308 return;
304 if (options.client_type != blink::kWebServiceWorkerClientTypeAll && 309 if (options.client_type != blink::kWebServiceWorkerClientTypeAll &&
305 options.client_type != host_client_type) 310 options.client_type != host_client_type)
306 return; 311 return;
307 312
308 ServiceWorkerClientInfo client_info( 313 ServiceWorkerClientInfo client_info(
309 host->client_uuid(), blink::kWebPageVisibilityStateHidden, 314 host->client_uuid(), blink::kWebPageVisibilityStateHidden,
310 false, // is_focused 315 false, // is_focused
311 host->document_url(), REQUEST_CONTEXT_FRAME_TYPE_NONE, base::TimeTicks(), 316 host->document_url(), REQUEST_CONTEXT_FRAME_TYPE_NONE, base::TimeTicks(),
312 host_client_type); 317 base::TimeTicks(), host_client_type);
leonhsl(Using Gerrit) 2017/05/24 07:26:31 Use host->create_time() ?
313 clients->push_back(client_info); 318 clients->push_back(client_info);
314 } 319 }
315 320
316 void OnGetWindowClientsOnUI( 321 void OnGetWindowClientsOnUI(
317 // The tuple contains process_id, frame_id, client_uuid. 322 // The tuple contains process_id, frame_id, client_uuid.
318 const std::vector<std::tuple<int, int, std::string>>& clients_info, 323 const std::vector<std::tuple<int, int, base::TimeTicks, std::string>>&
324 clients_info,
319 const GURL& script_url, 325 const GURL& script_url,
320 const GetWindowClientsCallback& callback) { 326 const GetWindowClientsCallback& callback) {
321 DCHECK_CURRENTLY_ON(BrowserThread::UI); 327 DCHECK_CURRENTLY_ON(BrowserThread::UI);
322 328
323 std::unique_ptr<ServiceWorkerClients> clients(new ServiceWorkerClients); 329 std::unique_ptr<ServiceWorkerClients> clients(new ServiceWorkerClients);
324 for (const auto& it : clients_info) { 330 for (const auto& it : clients_info) {
325 ServiceWorkerClientInfo info = GetWindowClientInfoOnUI( 331 ServiceWorkerClientInfo info = GetWindowClientInfoOnUI(
326 std::get<0>(it), std::get<1>(it), std::get<2>(it)); 332 std::get<0>(it), std::get<1>(it), std::get<2>(it), std::get<3>(it));
327 333
328 // If the request to the provider_host returned an empty 334 // If the request to the provider_host returned an empty
329 // ServiceWorkerClientInfo, that means that it wasn't possible to associate 335 // ServiceWorkerClientInfo, that means that it wasn't possible to associate
330 // it with a valid RenderFrameHost. It might be because the frame was killed 336 // it with a valid RenderFrameHost. It might be because the frame was killed
331 // or navigated in between. 337 // or navigated in between.
332 if (info.IsEmpty()) 338 if (info.IsEmpty())
333 continue; 339 continue;
334 340
335 // We can get info for a frame that was navigating end ended up with a 341 // We can get info for a frame that was navigating end ended up with a
336 // different URL than expected. In such case, we should make sure to not 342 // different URL than expected. In such case, we should make sure to not
337 // expose cross-origin WindowClient. 343 // expose cross-origin WindowClient.
338 if (info.url.GetOrigin() != script_url.GetOrigin()) 344 if (info.url.GetOrigin() != script_url.GetOrigin())
339 continue; 345 continue;
340 346
341 clients->push_back(info); 347 clients->push_back(info);
342 } 348 }
343 349
344 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 350 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
345 base::Bind(callback, base::Passed(&clients))); 351 base::Bind(callback, base::Passed(&clients)));
346 } 352 }
347 353
348 struct ServiceWorkerClientInfoSortMRU { 354 struct ServiceWorkerClientInfoSortMRU {
349 bool operator()(const ServiceWorkerClientInfo& a, 355 bool operator()(const ServiceWorkerClientInfo& a,
350 const ServiceWorkerClientInfo& b) const { 356 const ServiceWorkerClientInfo& b) const {
351 return a.last_focus_time > b.last_focus_time; 357 return a.last_focus_time > b.last_focus_time;
352 } 358 }
353 }; 359 };
354 360
361 struct ServiceWorkerClientInfoSortCreateTime {
362 bool operator()(const ServiceWorkerClientInfo& a,
363 const ServiceWorkerClientInfo& b) const {
364 return a.create_time < b.create_time;
365 }
366 };
367
355 void DidGetClients(const ClientsCallback& callback, 368 void DidGetClients(const ClientsCallback& callback,
356 ServiceWorkerClients* clients) { 369 ServiceWorkerClients* clients) {
357 DCHECK_CURRENTLY_ON(BrowserThread::IO); 370 DCHECK_CURRENTLY_ON(BrowserThread::IO);
358 371
359 // Sort clients so that the most recently active tab is in the front. 372 // Find the subgroud that ever been focused
xiaofengzhang 2017/05/24 06:07:33 subgroud --> subgroup Find the subgroud that ever
360 std::sort(clients->begin(), clients->end(), ServiceWorkerClientInfoSortMRU()); 373 auto bound = std::stable_partition(
374 clients->begin(), clients->end(), [](ServiceWorkerClientInfo info) {
375 return info.last_focus_time > base::TimeTicks();
376 });
377
378 // Sort focused clients so that the most recently active tab is in the front.
379 std::sort(clients->begin(), bound, ServiceWorkerClientInfoSortMRU());
380
381 // Sort non-focused clients so that the earliest created tab is in the front.
382 std::sort(bound, clients->end(), ServiceWorkerClientInfoSortCreateTime());
361 383
362 callback.Run(clients); 384 callback.Run(clients);
363 } 385 }
364 386
365 void GetNonWindowClients(const base::WeakPtr<ServiceWorkerVersion>& controller, 387 void GetNonWindowClients(const base::WeakPtr<ServiceWorkerVersion>& controller,
366 const ServiceWorkerClientQueryOptions& options, 388 const ServiceWorkerClientQueryOptions& options,
367 ServiceWorkerClients* clients) { 389 ServiceWorkerClients* clients) {
368 DCHECK_CURRENTLY_ON(BrowserThread::IO); 390 DCHECK_CURRENTLY_ON(BrowserThread::IO);
369 if (!options.include_uncontrolled) { 391 if (!options.include_uncontrolled) {
370 for (auto& controllee : controller->controllee_map()) 392 for (auto& controllee : controller->controllee_map())
(...skipping 17 matching lines...) Expand all
388 DidGetClients(callback, clients.get()); 410 DidGetClients(callback, clients.get());
389 } 411 }
390 412
391 void GetWindowClients(const base::WeakPtr<ServiceWorkerVersion>& controller, 413 void GetWindowClients(const base::WeakPtr<ServiceWorkerVersion>& controller,
392 const ServiceWorkerClientQueryOptions& options, 414 const ServiceWorkerClientQueryOptions& options,
393 const ClientsCallback& callback) { 415 const ClientsCallback& callback) {
394 DCHECK_CURRENTLY_ON(BrowserThread::IO); 416 DCHECK_CURRENTLY_ON(BrowserThread::IO);
395 DCHECK(options.client_type == blink::kWebServiceWorkerClientTypeWindow || 417 DCHECK(options.client_type == blink::kWebServiceWorkerClientTypeWindow ||
396 options.client_type == blink::kWebServiceWorkerClientTypeAll); 418 options.client_type == blink::kWebServiceWorkerClientTypeAll);
397 419
398 std::vector<std::tuple<int, int, std::string>> clients_info; 420 std::vector<std::tuple<int, int, base::TimeTicks, std::string>> clients_info;
399 if (!options.include_uncontrolled) { 421 if (!options.include_uncontrolled) {
400 for (auto& controllee : controller->controllee_map()) 422 for (auto& controllee : controller->controllee_map()) {
401 AddWindowClient(controllee.second, &clients_info); 423 AddWindowClient(controllee.second, &clients_info);
424 }
402 } else if (controller->context()) { 425 } else if (controller->context()) {
403 GURL origin = controller->script_url().GetOrigin(); 426 GURL origin = controller->script_url().GetOrigin();
404 for (auto it = controller->context()->GetClientProviderHostIterator(origin); 427 for (auto it = controller->context()->GetClientProviderHostIterator(origin);
405 !it->IsAtEnd(); it->Advance()) { 428 !it->IsAtEnd(); it->Advance()) {
406 AddWindowClient(it->GetProviderHost(), &clients_info); 429 AddWindowClient(it->GetProviderHost(), &clients_info);
407 } 430 }
408 } 431 }
409 432
410 if (clients_info.empty()) { 433 if (clients_info.empty()) {
411 DidGetWindowClients(controller, options, callback, 434 DidGetWindowClients(controller, options, callback,
(...skipping 11 matching lines...) Expand all
423 } // namespace 446 } // namespace
424 447
425 void FocusWindowClient(ServiceWorkerProviderHost* provider_host, 448 void FocusWindowClient(ServiceWorkerProviderHost* provider_host,
426 const ClientCallback& callback) { 449 const ClientCallback& callback) {
427 DCHECK_CURRENTLY_ON(BrowserThread::IO); 450 DCHECK_CURRENTLY_ON(BrowserThread::IO);
428 DCHECK_EQ(blink::kWebServiceWorkerClientTypeWindow, 451 DCHECK_EQ(blink::kWebServiceWorkerClientTypeWindow,
429 provider_host->client_type()); 452 provider_host->client_type());
430 BrowserThread::PostTaskAndReplyWithResult( 453 BrowserThread::PostTaskAndReplyWithResult(
431 BrowserThread::UI, FROM_HERE, 454 BrowserThread::UI, FROM_HERE,
432 base::Bind(&FocusOnUI, provider_host->process_id(), 455 base::Bind(&FocusOnUI, provider_host->process_id(),
433 provider_host->frame_id(), provider_host->client_uuid()), 456 provider_host->frame_id(), provider_host->create_time(),
457 provider_host->client_uuid()),
434 callback); 458 callback);
435 } 459 }
436 460
437 void OpenWindow(const GURL& url, 461 void OpenWindow(const GURL& url,
438 const GURL& script_url, 462 const GURL& script_url,
439 int worker_process_id, 463 int worker_process_id,
440 const base::WeakPtr<ServiceWorkerContextCore>& context, 464 const base::WeakPtr<ServiceWorkerContextCore>& context,
441 const NavigationCallback& callback) { 465 const NavigationCallback& callback) {
442 DCHECK_CURRENTLY_ON(BrowserThread::IO); 466 DCHECK_CURRENTLY_ON(BrowserThread::IO);
443 BrowserThread::PostTask( 467 BrowserThread::PostTask(
(...skipping 25 matching lines...) Expand all
469 blink::WebServiceWorkerClientType client_type = provider_host->client_type(); 493 blink::WebServiceWorkerClientType client_type = provider_host->client_type();
470 DCHECK(client_type == blink::kWebServiceWorkerClientTypeWindow || 494 DCHECK(client_type == blink::kWebServiceWorkerClientTypeWindow ||
471 client_type == blink::kWebServiceWorkerClientTypeWorker || 495 client_type == blink::kWebServiceWorkerClientTypeWorker ||
472 client_type == blink::kWebServiceWorkerClientTypeSharedWorker) 496 client_type == blink::kWebServiceWorkerClientTypeSharedWorker)
473 << client_type; 497 << client_type;
474 498
475 if (client_type == blink::kWebServiceWorkerClientTypeWindow) { 499 if (client_type == blink::kWebServiceWorkerClientTypeWindow) {
476 BrowserThread::PostTaskAndReplyWithResult( 500 BrowserThread::PostTaskAndReplyWithResult(
477 BrowserThread::UI, FROM_HERE, 501 BrowserThread::UI, FROM_HERE,
478 base::Bind(&GetWindowClientInfoOnUI, provider_host->process_id(), 502 base::Bind(&GetWindowClientInfoOnUI, provider_host->process_id(),
479 provider_host->route_id(), provider_host->client_uuid()), 503 provider_host->route_id(), provider_host->create_time(),
504 provider_host->client_uuid()),
480 callback); 505 callback);
481 return; 506 return;
482 } 507 }
483 508
484 ServiceWorkerClientInfo client_info( 509 ServiceWorkerClientInfo client_info(
485 provider_host->client_uuid(), blink::kWebPageVisibilityStateHidden, 510 provider_host->client_uuid(), blink::kWebPageVisibilityStateHidden,
486 false, // is_focused 511 false, // is_focused
487 provider_host->document_url(), REQUEST_CONTEXT_FRAME_TYPE_NONE, 512 provider_host->document_url(), REQUEST_CONTEXT_FRAME_TYPE_NONE,
488 base::TimeTicks(), provider_host->client_type()); 513 base::TimeTicks(), base::TimeTicks(), provider_host->client_type());
leonhsl(Using Gerrit) 2017/05/24 07:26:31 Use provider_host->create_time() ?
489 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 514 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
490 base::Bind(callback, client_info)); 515 base::Bind(callback, client_info));
491 } 516 }
492 517
493 void GetClients(const base::WeakPtr<ServiceWorkerVersion>& controller, 518 void GetClients(const base::WeakPtr<ServiceWorkerVersion>& controller,
494 const ServiceWorkerClientQueryOptions& options, 519 const ServiceWorkerClientQueryOptions& options,
495 const ClientsCallback& callback) { 520 const ClientsCallback& callback) {
496 DCHECK_CURRENTLY_ON(BrowserThread::IO); 521 DCHECK_CURRENTLY_ON(BrowserThread::IO);
497 522
498 ServiceWorkerClients clients; 523 ServiceWorkerClients clients;
499 if (!controller->HasControllee() && !options.include_uncontrolled) { 524 if (!controller->HasControllee() && !options.include_uncontrolled) {
500 DidGetClients(callback, &clients); 525 DidGetClients(callback, &clients);
501 return; 526 return;
502 } 527 }
503 528
504 // For Window clients we want to query the info on the UI thread first. 529 // For Window clients we want to query the info on the UI thread first.
505 if (options.client_type == blink::kWebServiceWorkerClientTypeWindow || 530 if (options.client_type == blink::kWebServiceWorkerClientTypeWindow ||
506 options.client_type == blink::kWebServiceWorkerClientTypeAll) { 531 options.client_type == blink::kWebServiceWorkerClientTypeAll) {
507 GetWindowClients(controller, options, callback); 532 GetWindowClients(controller, options, callback);
508 return; 533 return;
509 } 534 }
510 535
511 GetNonWindowClients(controller, options, &clients); 536 GetNonWindowClients(controller, options, &clients);
512 DidGetClients(callback, &clients); 537 DidGetClients(callback, &clients);
513 } 538 }
514 539
515 } // namespace service_worker_client_utils 540 } // namespace service_worker_client_utils
516 } // namespace content 541 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_provider_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698