| Index: base/global_descriptors_posix.cc
|
| diff --git a/base/global_descriptors_posix.cc b/base/global_descriptors_posix.cc
|
| index 2fe953cf00c69914676baed70d6bfd0c99ff9b17..65e795563be7c241f2f697864c1530e52b6d824b 100644
|
| --- a/base/global_descriptors_posix.cc
|
| +++ b/base/global_descriptors_posix.cc
|
| @@ -11,10 +11,6 @@
|
|
|
| namespace base {
|
|
|
| -GlobalDescriptors::GlobalDescriptors() {}
|
| -
|
| -GlobalDescriptors::~GlobalDescriptors() {}
|
| -
|
| // static
|
| GlobalDescriptors* GlobalDescriptors::GetInstance() {
|
| typedef Singleton<base::GlobalDescriptors,
|
| @@ -23,6 +19,14 @@ GlobalDescriptors* GlobalDescriptors::GetInstance() {
|
| return GlobalDescriptorsSingleton::get();
|
| }
|
|
|
| +int GlobalDescriptors::Get(Key key) const {
|
| + const int ret = MaybeGet(key);
|
| +
|
| + if (ret == -1)
|
| + LOG(FATAL) << "Unknown global descriptor: " << key;
|
| + return ret;
|
| +}
|
| +
|
| int GlobalDescriptors::MaybeGet(Key key) const {
|
| for (Mapping::const_iterator
|
| i = descriptors_.begin(); i != descriptors_.end(); ++i) {
|
| @@ -35,14 +39,6 @@ int GlobalDescriptors::MaybeGet(Key key) const {
|
| return kBaseDescriptor + key;
|
| }
|
|
|
| -int GlobalDescriptors::Get(Key key) const {
|
| - const int ret = MaybeGet(key);
|
| -
|
| - if (ret == -1)
|
| - LOG(FATAL) << "Unknown global descriptor: " << key;
|
| - return ret;
|
| -}
|
| -
|
| void GlobalDescriptors::Set(Key key, int fd) {
|
| for (Mapping::iterator
|
| i = descriptors_.begin(); i != descriptors_.end(); ++i) {
|
| @@ -55,4 +51,12 @@ void GlobalDescriptors::Set(Key key, int fd) {
|
| descriptors_.push_back(std::make_pair(key, fd));
|
| }
|
|
|
| +void GlobalDescriptors::Reset(const Mapping& mapping) {
|
| + descriptors_ = mapping;
|
| +}
|
| +
|
| +GlobalDescriptors::GlobalDescriptors() {}
|
| +
|
| +GlobalDescriptors::~GlobalDescriptors() {}
|
| +
|
| } // namespace base
|
|
|