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

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

Issue 1285373002: Ensure that Service Worker clients are always returned in MRU order (1) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typos and style. Created 5 years, 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_provider_host.h" 5 #include "content/browser/service_worker/service_worker_provider_host.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "content/browser/frame_host/frame_tree.h" 9 #include "content/browser/frame_host/frame_tree.h"
10 #include "content/browser/frame_host/frame_tree_node.h" 10 #include "content/browser/frame_host/frame_tree_node.h"
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 } 435 }
436 436
437 // static 437 // static
438 ServiceWorkerClientInfo ServiceWorkerProviderHost::GetWindowClientInfoOnUI( 438 ServiceWorkerClientInfo ServiceWorkerProviderHost::GetWindowClientInfoOnUI(
439 int render_process_id, 439 int render_process_id,
440 int render_frame_id) { 440 int render_frame_id) {
441 RenderFrameHostImpl* render_frame_host = 441 RenderFrameHostImpl* render_frame_host =
442 RenderFrameHostImpl::FromID(render_process_id, render_frame_id); 442 RenderFrameHostImpl::FromID(render_process_id, render_frame_id);
443 if (!render_frame_host) 443 if (!render_frame_host)
444 return ServiceWorkerClientInfo(); 444 return ServiceWorkerClientInfo();
445 WebContents* web_contents =
446 WebContents::FromRenderFrameHost(render_frame_host);
445 447
446 // TODO(mlamouri,michaeln): it is possible to end up collecting information 448 // TODO(mlamouri,michaeln): it is possible to end up collecting information
447 // for a frame that is actually being navigated and isn't exactly what we are 449 // for a frame that is actually being navigated and isn't exactly what we are
448 // expecting. 450 // expecting.
449 return ServiceWorkerClientInfo( 451 return ServiceWorkerClientInfo(
450 render_frame_host->GetVisibilityState(), 452 render_frame_host->GetVisibilityState(), render_frame_host->IsFocused(),
451 render_frame_host->IsFocused(),
452 render_frame_host->GetLastCommittedURL(), 453 render_frame_host->GetLastCommittedURL(),
453 render_frame_host->GetParent() ? REQUEST_CONTEXT_FRAME_TYPE_NESTED 454 render_frame_host->GetParent() ? REQUEST_CONTEXT_FRAME_TYPE_NESTED
454 : REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL, 455 : REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL,
456 web_contents ? web_contents->GetLastActiveTime() : base::TimeTicks(),
falken 2015/08/17 06:28:32 I'm curious when web_contents would be null? Anyon
jeremyarcher 2015/08/17 06:51:57 I'm honestly not sure- the comment below in web_co
455 blink::WebServiceWorkerClientTypeWindow); 457 blink::WebServiceWorkerClientTypeWindow);
456 } 458 }
457 459
458 void ServiceWorkerProviderHost::AddScopedProcessReferenceToPattern( 460 void ServiceWorkerProviderHost::AddScopedProcessReferenceToPattern(
459 const GURL& pattern) { 461 const GURL& pattern) {
460 associated_patterns_.push_back(pattern); 462 associated_patterns_.push_back(pattern);
461 IncreaseProcessReference(pattern); 463 IncreaseProcessReference(pattern);
462 } 464 }
463 465
464 void ServiceWorkerProviderHost::ClaimedByRegistration( 466 void ServiceWorkerProviderHost::ClaimedByRegistration(
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 return context_ != NULL; 683 return context_ != NULL;
682 } 684 }
683 685
684 void ServiceWorkerProviderHost::Send(IPC::Message* message) const { 686 void ServiceWorkerProviderHost::Send(IPC::Message* message) const {
685 DCHECK(dispatcher_host_); 687 DCHECK(dispatcher_host_);
686 DCHECK(IsReadyToSendMessages()); 688 DCHECK(IsReadyToSendMessages());
687 dispatcher_host_->Send(message); 689 dispatcher_host_->Send(message);
688 } 690 }
689 691
690 } // namespace content 692 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698