| OLD | NEW |
| 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 { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 ExecutionContext* context) { | 31 ExecutionContext* context) { |
| 32 return static_cast<WorkerNavigatorNetworkInformation*>( | 32 return static_cast<WorkerNavigatorNetworkInformation*>( |
| 33 Supplement<WorkerNavigator>::from(navigator, supplementName())); | 33 Supplement<WorkerNavigator>::from(navigator, supplementName())); |
| 34 } | 34 } |
| 35 | 35 |
| 36 const char* WorkerNavigatorNetworkInformation::supplementName() { | 36 const char* WorkerNavigatorNetworkInformation::supplementName() { |
| 37 return "WorkerNavigatorNetworkInformation"; | 37 return "WorkerNavigatorNetworkInformation"; |
| 38 } | 38 } |
| 39 | 39 |
| 40 NetworkInformation* WorkerNavigatorNetworkInformation::connection( | 40 NetworkInformation* WorkerNavigatorNetworkInformation::connection( |
| 41 ExecutionContext* context, | 41 ScriptState* scriptState, |
| 42 WorkerNavigator& navigator) { | 42 WorkerNavigator& navigator) { |
| 43 ExecutionContext* context = scriptState->getExecutionContext(); |
| 43 return WorkerNavigatorNetworkInformation::from(navigator, context) | 44 return WorkerNavigatorNetworkInformation::from(navigator, context) |
| 44 .connection(context); | 45 .connection(context); |
| 45 } | 46 } |
| 46 | 47 |
| 47 DEFINE_TRACE(WorkerNavigatorNetworkInformation) { | 48 DEFINE_TRACE(WorkerNavigatorNetworkInformation) { |
| 48 visitor->trace(m_connection); | 49 visitor->trace(m_connection); |
| 49 Supplement<WorkerNavigator>::trace(visitor); | 50 Supplement<WorkerNavigator>::trace(visitor); |
| 50 } | 51 } |
| 51 | 52 |
| 52 NetworkInformation* WorkerNavigatorNetworkInformation::connection( | 53 NetworkInformation* WorkerNavigatorNetworkInformation::connection( |
| 53 ExecutionContext* context) { | 54 ExecutionContext* context) { |
| 54 ASSERT(context); | 55 ASSERT(context); |
| 55 if (!m_connection) | 56 if (!m_connection) |
| 56 m_connection = NetworkInformation::create(context); | 57 m_connection = NetworkInformation::create(context); |
| 57 return m_connection.get(); | 58 return m_connection.get(); |
| 58 } | 59 } |
| 59 | 60 |
| 60 } // namespace blink | 61 } // namespace blink |
| OLD | NEW |