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

Side by Side Diff: content/common/service_worker/service_worker_client_info.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 inconsistencies. 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
« no previous file with comments | « content/common/service_worker/service_worker_client_info.h ('k') | no next file » | 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/common/service_worker/service_worker_client_info.h" 5 #include "content/common/service_worker/service_worker_client_info.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/common/service_worker/service_worker_types.h" 8 #include "content/common/service_worker/service_worker_types.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 ServiceWorkerClientInfo::ServiceWorkerClientInfo() 12 ServiceWorkerClientInfo::ServiceWorkerClientInfo()
13 : page_visibility_state(blink::WebPageVisibilityStateLast), 13 : page_visibility_state(blink::WebPageVisibilityStateLast),
14 is_focused(false), 14 is_focused(false),
15 frame_type(REQUEST_CONTEXT_FRAME_TYPE_LAST), 15 frame_type(REQUEST_CONTEXT_FRAME_TYPE_LAST),
16 client_type(blink::WebServiceWorkerClientTypeLast) { 16 client_type(blink::WebServiceWorkerClientTypeLast),
17 } 17 last_focus_time(base::TimeTicks()) {}
18 18
19 ServiceWorkerClientInfo::ServiceWorkerClientInfo( 19 ServiceWorkerClientInfo::ServiceWorkerClientInfo(
20 blink::WebPageVisibilityState page_visibility_state, 20 blink::WebPageVisibilityState page_visibility_state,
21 bool is_focused, 21 bool is_focused,
22 const GURL& url, 22 const GURL& url,
23 RequestContextFrameType frame_type, 23 RequestContextFrameType frame_type,
24 base::TimeTicks last_focus_time,
24 blink::WebServiceWorkerClientType client_type) 25 blink::WebServiceWorkerClientType client_type)
25 : page_visibility_state(page_visibility_state), 26 : page_visibility_state(page_visibility_state),
26 is_focused(is_focused), 27 is_focused(is_focused),
27 url(url), 28 url(url),
28 frame_type(frame_type), 29 frame_type(frame_type),
29 client_type(client_type) { 30 client_type(client_type),
30 } 31 last_focus_time(last_focus_time) {}
31 32
32 bool ServiceWorkerClientInfo::IsEmpty() const { 33 bool ServiceWorkerClientInfo::IsEmpty() const {
33 return page_visibility_state == blink::WebPageVisibilityStateLast && 34 return page_visibility_state == blink::WebPageVisibilityStateLast &&
34 is_focused == false && 35 is_focused == false &&
35 url.is_empty() && 36 url.is_empty() &&
36 frame_type == REQUEST_CONTEXT_FRAME_TYPE_LAST && 37 frame_type == REQUEST_CONTEXT_FRAME_TYPE_LAST &&
37 client_type == blink::WebServiceWorkerClientTypeLast; 38 client_type == blink::WebServiceWorkerClientTypeLast;
38 } 39 }
39 40
40 bool ServiceWorkerClientInfo::IsValid() const { 41 bool ServiceWorkerClientInfo::IsValid() const {
41 return !IsEmpty() && !client_uuid.empty(); 42 return !IsEmpty() && !client_uuid.empty();
42 } 43 }
43 44
44 } // namespace content 45 } // namespace content
OLDNEW
« no previous file with comments | « content/common/service_worker/service_worker_client_info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698