Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(598)

Side by Side Diff: chromecast/base/device_capabilities_impl.h

Issue 1884453002: Revert of Convert //net and //chromecast to std::unordered_* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chromecast/base/device_capabilities_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CHROMECAST_BASE_DEVICE_CAPABILITIES_IMPL_H_ 5 #ifndef CHROMECAST_BASE_DEVICE_CAPABILITIES_IMPL_H_
6 #define CHROMECAST_BASE_DEVICE_CAPABILITIES_IMPL_H_ 6 #define CHROMECAST_BASE_DEVICE_CAPABILITIES_IMPL_H_
7 7
8 #include <memory>
9 #include <string> 8 #include <string>
10 #include <unordered_map>
11 9
10 #include "base/containers/scoped_ptr_hash_map.h"
12 #include "base/macros.h" 11 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
14 #include "base/observer_list_threadsafe.h" 13 #include "base/observer_list_threadsafe.h"
15 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
16 #include "chromecast/base/device_capabilities.h" 15 #include "chromecast/base/device_capabilities.h"
17 16
18 namespace base { 17 namespace base {
19 class SingleThreadTaskRunner; 18 class SingleThreadTaskRunner;
20 } 19 }
21 20
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 DISALLOW_COPY_AND_ASSIGN(ValidatorInfo); 63 DISALLOW_COPY_AND_ASSIGN(ValidatorInfo);
65 }; 64 };
66 65
67 // For DeviceCapabilitiesImpl() 66 // For DeviceCapabilitiesImpl()
68 friend class DeviceCapabilities; 67 friend class DeviceCapabilities;
69 // For SetValidatedValueInternal() 68 // For SetValidatedValueInternal()
70 friend class DeviceCapabilities::Validator; 69 friend class DeviceCapabilities::Validator;
71 70
72 // Map from capability key to corresponding ValidatorInfo. Gets updated 71 // Map from capability key to corresponding ValidatorInfo. Gets updated
73 // in Register()/Unregister(). 72 // in Register()/Unregister().
74 using ValidatorMap = 73 typedef base::ScopedPtrHashMap<std::string, std::unique_ptr<ValidatorInfo>>
75 std::unordered_map<std::string, std::unique_ptr<ValidatorInfo>>; 74 ValidatorMap;
76 75
77 // Internal constructor used by static DeviceCapabilities::Create*() methods. 76 // Internal constructor used by static DeviceCapabilities::Create*() methods.
78 DeviceCapabilitiesImpl(); 77 DeviceCapabilitiesImpl();
79 78
80 void SetValidatedValue(const std::string& path, 79 void SetValidatedValue(const std::string& path,
81 std::unique_ptr<base::Value> new_value) override; 80 std::unique_ptr<base::Value> new_value) override;
82 81
83 // Lock for reading/writing data_ pointer 82 // Lock for reading/writing data_ pointer
84 mutable base::Lock data_lock_; 83 mutable base::Lock data_lock_;
85 // Lock for reading/writing validator_map_ 84 // Lock for reading/writing validator_map_
86 mutable base::Lock validation_lock_; 85 mutable base::Lock validation_lock_;
87 86
88 scoped_refptr<Data> data_; 87 scoped_refptr<Data> data_;
89 // TaskRunner for capability writes. All internal writes to data_ must occur 88 // TaskRunner for capability writes. All internal writes to data_ must occur
90 // on task_runner_for_writes_'s thread. 89 // on task_runner_for_writes_'s thread.
91 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_for_writes_; 90 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_for_writes_;
92 91
93 ValidatorMap validator_map_; 92 ValidatorMap validator_map_;
94 const scoped_refptr<base::ObserverListThreadSafe<Observer>> observer_list_; 93 const scoped_refptr<base::ObserverListThreadSafe<Observer>> observer_list_;
95 94
96 DISALLOW_COPY_AND_ASSIGN(DeviceCapabilitiesImpl); 95 DISALLOW_COPY_AND_ASSIGN(DeviceCapabilitiesImpl);
97 }; 96 };
98 97
99 } // namespace chromecast 98 } // namespace chromecast
100 99
101 #endif // CHROMECAST_BASE_DEVICE_CAPABILITIES_IMPL_H_ 100 #endif // CHROMECAST_BASE_DEVICE_CAPABILITIES_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | chromecast/base/device_capabilities_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698