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

Side by Side Diff: third_party/WebKit/Source/modules/netinfo/WorkerNavigatorNetworkInformation.cpp

Issue 1846913009: HeapSupplements are now just Supplements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "modules/netinfo/WorkerNavigatorNetworkInformation.h" 5 #include "modules/netinfo/WorkerNavigatorNetworkInformation.h"
6 6
7 #include "core/workers/WorkerNavigator.h" 7 #include "core/workers/WorkerNavigator.h"
8 #include "modules/netinfo/NetworkInformation.h" 8 #include "modules/netinfo/NetworkInformation.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 WorkerNavigatorNetworkInformation::WorkerNavigatorNetworkInformation(WorkerNavig ator& navigator, ExecutionContext* context) 12 WorkerNavigatorNetworkInformation::WorkerNavigatorNetworkInformation(WorkerNavig ator& navigator, ExecutionContext* context)
13 { 13 {
14 } 14 }
15 15
16 WorkerNavigatorNetworkInformation& WorkerNavigatorNetworkInformation::from(Worke rNavigator& navigator, ExecutionContext* context) 16 WorkerNavigatorNetworkInformation& WorkerNavigatorNetworkInformation::from(Worke rNavigator& navigator, ExecutionContext* context)
17 { 17 {
18 WorkerNavigatorNetworkInformation* supplement = toWorkerNavigatorNetworkInfo rmation(navigator, context); 18 WorkerNavigatorNetworkInformation* supplement = toWorkerNavigatorNetworkInfo rmation(navigator, context);
19 if (!supplement) { 19 if (!supplement) {
20 supplement = new WorkerNavigatorNetworkInformation(navigator, context); 20 supplement = new WorkerNavigatorNetworkInformation(navigator, context);
21 provideTo(navigator, supplementName(), supplement); 21 provideTo(navigator, supplementName(), supplement);
22 } 22 }
23 return *supplement; 23 return *supplement;
24 } 24 }
25 25
26 WorkerNavigatorNetworkInformation* WorkerNavigatorNetworkInformation::toWorkerNa vigatorNetworkInformation(WorkerNavigator& navigator, ExecutionContext* context) 26 WorkerNavigatorNetworkInformation* WorkerNavigatorNetworkInformation::toWorkerNa vigatorNetworkInformation(WorkerNavigator& navigator, ExecutionContext* context)
27 { 27 {
28 return static_cast<WorkerNavigatorNetworkInformation*>(HeapSupplement<Worker Navigator>::from(navigator, supplementName())); 28 return static_cast<WorkerNavigatorNetworkInformation*>(Supplement<WorkerNavi gator>::from(navigator, supplementName()));
29 } 29 }
30 30
31 const char* WorkerNavigatorNetworkInformation::supplementName() 31 const char* WorkerNavigatorNetworkInformation::supplementName()
32 { 32 {
33 return "WorkerNavigatorNetworkInformation"; 33 return "WorkerNavigatorNetworkInformation";
34 } 34 }
35 35
36 NetworkInformation* WorkerNavigatorNetworkInformation::connection(ExecutionConte xt* context, WorkerNavigator& navigator) 36 NetworkInformation* WorkerNavigatorNetworkInformation::connection(ExecutionConte xt* context, WorkerNavigator& navigator)
37 { 37 {
38 return WorkerNavigatorNetworkInformation::from(navigator, context).connectio n(context); 38 return WorkerNavigatorNetworkInformation::from(navigator, context).connectio n(context);
39 } 39 }
40 40
41 DEFINE_TRACE(WorkerNavigatorNetworkInformation) 41 DEFINE_TRACE(WorkerNavigatorNetworkInformation)
42 { 42 {
43 visitor->trace(m_connection); 43 visitor->trace(m_connection);
44 HeapSupplement<WorkerNavigator>::trace(visitor); 44 Supplement<WorkerNavigator>::trace(visitor);
45 } 45 }
46 46
47 NetworkInformation* WorkerNavigatorNetworkInformation::connection(ExecutionConte xt* context) 47 NetworkInformation* WorkerNavigatorNetworkInformation::connection(ExecutionConte xt* context)
48 { 48 {
49 ASSERT(context); 49 ASSERT(context);
50 if (!m_connection) 50 if (!m_connection)
51 m_connection = NetworkInformation::create(context); 51 m_connection = NetworkInformation::create(context);
52 return m_connection.get(); 52 return m_connection.get();
53 } 53 }
54 54
55 } // namespace blink 55 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698