Commit a34cc099 authored by hans@chromium.org's avatar hans@chromium.org

Clean-up inline members of nested classes (base/)

Due to a bug, the Clang-plugin style checker failed to warn about
inline constructors, destructors, non-empty virtual methods, etc.
for nested classes.

The plugin has been fixed, and this patch is part of a clean-up of all
the code that now causes the plugin to issue errors.

BUG=139346


Review URL: https://chromiumcodereview.appspot.com/10825273

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151016 0039d316-1c4b-4281-b951-d872f2087c98
parent 96bb7f65
...@@ -22,6 +22,17 @@ static SystemMonitor* g_system_monitor = NULL; ...@@ -22,6 +22,17 @@ static SystemMonitor* g_system_monitor = NULL;
static int kDelayedBatteryCheckMs = 10 * 1000; static int kDelayedBatteryCheckMs = 10 * 1000;
#endif // defined(ENABLE_BATTERY_MONITORING) #endif // defined(ENABLE_BATTERY_MONITORING)
SystemMonitor::MediaDeviceInfo::MediaDeviceInfo(
const std::string& id,
const string16& device_name,
MediaDeviceType device_type,
const FilePath::StringType& device_location)
: unique_id(id),
name(device_name),
type(device_type),
location(device_location) {
}
SystemMonitor::SystemMonitor() SystemMonitor::SystemMonitor()
: power_observer_list_(new ObserverListThreadSafe<PowerObserver>()), : power_observer_list_(new ObserverListThreadSafe<PowerObserver>()),
devices_changed_observer_list_( devices_changed_observer_list_(
......
...@@ -64,16 +64,11 @@ class BASE_EXPORT SystemMonitor { ...@@ -64,16 +64,11 @@ class BASE_EXPORT SystemMonitor {
TYPE_MTP, // (W)string to locate a MTP device, e.g. its usb bus/port. TYPE_MTP, // (W)string to locate a MTP device, e.g. its usb bus/port.
}; };
struct MediaDeviceInfo { struct BASE_EXPORT MediaDeviceInfo {
MediaDeviceInfo(const std::string& id, MediaDeviceInfo(const std::string& id,
const string16& device_name, const string16& device_name,
MediaDeviceType device_type, MediaDeviceType device_type,
const FilePath::StringType& device_location) const FilePath::StringType& device_location);
: unique_id(id),
name(device_name),
type(device_type),
location(device_location) {
}
// Unique media device id - persists between device attachments. // Unique media device id - persists between device attachments.
std::string unique_id; std::string unique_id;
......
...@@ -750,6 +750,18 @@ void DictionaryValue::Swap(DictionaryValue* other) { ...@@ -750,6 +750,18 @@ void DictionaryValue::Swap(DictionaryValue* other) {
dictionary_.swap(other->dictionary_); dictionary_.swap(other->dictionary_);
} }
DictionaryValue::key_iterator::key_iterator(ValueMap::const_iterator itr) {
itr_ = itr;
}
DictionaryValue::key_iterator::key_iterator(const key_iterator& rhs) {
itr_ = rhs.itr_;
}
DictionaryValue::Iterator::Iterator(const DictionaryValue& target)
: target_(target),
it_(target.dictionary_.begin()) {}
DictionaryValue* DictionaryValue::DeepCopy() const { DictionaryValue* DictionaryValue::DeepCopy() const {
DictionaryValue* result = new DictionaryValue; DictionaryValue* result = new DictionaryValue;
......
...@@ -339,10 +339,12 @@ class BASE_EXPORT DictionaryValue : public Value { ...@@ -339,10 +339,12 @@ class BASE_EXPORT DictionaryValue : public Value {
// YOU SHOULD ALWAYS USE THE XXXWithoutPathExpansion() APIs WITH THESE, NOT // YOU SHOULD ALWAYS USE THE XXXWithoutPathExpansion() APIs WITH THESE, NOT
// THE NORMAL XXX() APIs. This makes sure things will work correctly if any // THE NORMAL XXX() APIs. This makes sure things will work correctly if any
// keys have '.'s in them. // keys have '.'s in them.
class key_iterator class BASE_EXPORT key_iterator
: private std::iterator<std::input_iterator_tag, const std::string> { : private std::iterator<std::input_iterator_tag, const std::string> {
public: public:
explicit key_iterator(ValueMap::const_iterator itr) { itr_ = itr; } explicit key_iterator(ValueMap::const_iterator itr);
// Not explicit, because this is a copy constructor.
key_iterator(const key_iterator& rhs);
key_iterator operator++() { key_iterator operator++() {
++itr_; ++itr_;
return *this; return *this;
...@@ -360,10 +362,9 @@ class BASE_EXPORT DictionaryValue : public Value { ...@@ -360,10 +362,9 @@ class BASE_EXPORT DictionaryValue : public Value {
// This class provides an iterator over both keys and values in the // This class provides an iterator over both keys and values in the
// dictionary. It can't be used to modify the dictionary. // dictionary. It can't be used to modify the dictionary.
class Iterator { class BASE_EXPORT Iterator {
public: public:
explicit Iterator(const DictionaryValue& target) explicit Iterator(const DictionaryValue& target);
: target_(target), it_(target.dictionary_.begin()) {}
bool HasNext() const { return it_ != target_.dictionary_.end(); } bool HasNext() const { return it_ != target_.dictionary_.end(); }
void Advance() { ++it_; } void Advance() { ++it_; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment