| 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 "device/core/device_client.h" | 5 #include "device/core/device_client.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace device { | 9 namespace device { |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 DeviceClient* g_instance = NULL; | 13 DeviceClient* g_instance; |
| 14 | 14 |
| 15 } // namespace | 15 } // namespace |
| 16 | 16 |
| 17 DeviceClient::DeviceClient() { | 17 DeviceClient::DeviceClient() { |
| 18 DCHECK(!g_instance); | |
| 19 g_instance = this; | 18 g_instance = this; |
| 20 } | 19 } |
| 21 | 20 |
| 22 DeviceClient::~DeviceClient() { | 21 DeviceClient::~DeviceClient() { |
| 23 g_instance = NULL; | 22 g_instance = nullptr; |
| 24 } | 23 } |
| 25 | 24 |
| 26 /* static */ | 25 /* static */ |
| 27 DeviceClient* DeviceClient::Get() { | 26 DeviceClient* DeviceClient::Get() { |
| 28 DCHECK(g_instance); | 27 DCHECK(g_instance); |
| 29 return g_instance; | 28 return g_instance; |
| 30 } | 29 } |
| 31 | 30 |
| 32 UsbService* DeviceClient::GetUsbService() { | 31 UsbService* DeviceClient::GetUsbService() { |
| 33 // This should never be called by clients which do not support the USB API. | 32 // This should never be called by clients which do not support the USB API. |
| 34 NOTREACHED(); | 33 NOTREACHED(); |
| 35 return NULL; | 34 return nullptr; |
| 36 } | 35 } |
| 37 | 36 |
| 38 HidService* DeviceClient::GetHidService() { | 37 HidService* DeviceClient::GetHidService() { |
| 39 // This should never be called by clients which do not support the HID API. | 38 // This should never be called by clients which do not support the HID API. |
| 40 NOTREACHED(); | 39 NOTREACHED(); |
| 41 return NULL; | 40 return nullptr; |
| 42 } | 41 } |
| 43 | 42 |
| 44 } // namespace device | 43 } // namespace device |
| OLD | NEW |