| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/serial/serial_connection.h" | 5 #include "chrome/browser/extensions/api/serial/serial_connection.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 static base::LazyInstance<ProfileKeyedAPIFactory< | 25 static base::LazyInstance<ProfileKeyedAPIFactory< |
| 26 ApiResourceManager<SerialConnection> > > | 26 ApiResourceManager<SerialConnection> > > |
| 27 g_factory = LAZY_INSTANCE_INITIALIZER; | 27 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 28 | 28 |
| 29 // static | 29 // static |
| 30 template <> | 30 template <> |
| 31 ProfileKeyedAPIFactory<ApiResourceManager<SerialConnection> >* | 31 ProfileKeyedAPIFactory<ApiResourceManager<SerialConnection> >* |
| 32 ApiResourceManager<SerialConnection>::GetFactoryInstance() { | 32 ApiResourceManager<SerialConnection>::GetFactoryInstance() { |
| 33 return &g_factory.Get(); | 33 return g_factory.Pointer(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 SerialConnection::SerialConnection(const std::string& port, | 36 SerialConnection::SerialConnection(const std::string& port, |
| 37 const std::string& owner_extension_id) | 37 const std::string& owner_extension_id) |
| 38 : ApiResource(owner_extension_id), | 38 : ApiResource(owner_extension_id), |
| 39 port_(port), | 39 port_(port), |
| 40 file_(base::kInvalidPlatformFileValue), | 40 file_(base::kInvalidPlatformFileValue), |
| 41 persistent_(false), | 41 persistent_(false), |
| 42 buffer_size_(kDefaultBufferSize), | 42 buffer_size_(kDefaultBufferSize), |
| 43 receive_timeout_(0), | 43 receive_timeout_(0), |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 delay_); | 265 delay_); |
| 266 } | 266 } |
| 267 | 267 |
| 268 SerialConnection::TimeoutTask::~TimeoutTask() {} | 268 SerialConnection::TimeoutTask::~TimeoutTask() {} |
| 269 | 269 |
| 270 void SerialConnection::TimeoutTask::Run() const { | 270 void SerialConnection::TimeoutTask::Run() const { |
| 271 closure_.Run(); | 271 closure_.Run(); |
| 272 } | 272 } |
| 273 | 273 |
| 274 } // namespace extensions | 274 } // namespace extensions |
| OLD | NEW |