| 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/hid/hid_service.h" | 5 #include "device/hid/hid_service.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 class HidService::Destroyer : public base::MessageLoop::DestructionObserver { | 30 class HidService::Destroyer : public base::MessageLoop::DestructionObserver { |
| 31 public: | 31 public: |
| 32 explicit Destroyer(HidService* hid_service) | 32 explicit Destroyer(HidService* hid_service) |
| 33 : hid_service_(hid_service) {} | 33 : hid_service_(hid_service) {} |
| 34 virtual ~Destroyer() {} | 34 virtual ~Destroyer() {} |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 // base::MessageLoop::DestructionObserver implementation. | 37 // base::MessageLoop::DestructionObserver implementation. |
| 38 virtual void WillDestroyCurrentMessageLoop() OVERRIDE { | 38 virtual void WillDestroyCurrentMessageLoop() override { |
| 39 base::MessageLoop::current()->RemoveDestructionObserver(this); | 39 base::MessageLoop::current()->RemoveDestructionObserver(this); |
| 40 delete hid_service_; | 40 delete hid_service_; |
| 41 delete this; | 41 delete this; |
| 42 g_service = NULL; | 42 g_service = NULL; |
| 43 } | 43 } |
| 44 | 44 |
| 45 HidService* hid_service_; | 45 HidService* hid_service_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 HidService* HidService::GetInstance( | 48 HidService* HidService::GetInstance( |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 DeviceMap::iterator it = devices_.find(device_id); | 104 DeviceMap::iterator it = devices_.find(device_id); |
| 105 if (it != devices_.end()) | 105 if (it != devices_.end()) |
| 106 devices_.erase(it); | 106 devices_.erase(it); |
| 107 } | 107 } |
| 108 | 108 |
| 109 const HidService::DeviceMap& HidService::GetDevicesNoEnumerate() const { | 109 const HidService::DeviceMap& HidService::GetDevicesNoEnumerate() const { |
| 110 return devices_; | 110 return devices_; |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace device | 113 } // namespace device |
| OLD | NEW |