| // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "base/posix/global_descriptors.h" |
| #include "base/logging.h" |
| GlobalDescriptors* GlobalDescriptors::GetInstance() { |
| typedef Singleton<base::GlobalDescriptors, |
| LeakySingletonTraits<base::GlobalDescriptors> > |
| GlobalDescriptorsSingleton; |
| return GlobalDescriptorsSingleton::get(); |
| int GlobalDescriptors::Get(Key key) const { |
| const int ret = MaybeGet(key); |
| DLOG(FATAL) << "Unknown global descriptor: " << key; |
| int GlobalDescriptors::MaybeGet(Key key) const { |
| for (Mapping::const_iterator |
| i = descriptors_.begin(); i != descriptors_.end(); ++i) { |
| void GlobalDescriptors::Set(Key key, int fd) { |
| i = descriptors_.begin(); i != descriptors_.end(); ++i) { |
| descriptors_.push_back(std::make_pair(key, fd)); |
| void GlobalDescriptors::Reset(const Mapping& mapping) { |
| GlobalDescriptors::GlobalDescriptors() {} |
| GlobalDescriptors::~GlobalDescriptors() {} |