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

Unified Diff: base/values.cc

Issue 6189001: Make the order of methods in the cc files match the headers in base/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/task_queue.cc ('k') | base/version.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/values.cc
diff --git a/base/values.cc b/base/values.cc
index 4553e68dc2d9d810a05f929b111ca683ecc61a40..35225698c54d56eb83be645256a80b04dabb0341 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -263,6 +263,12 @@ bool StringValue::Equals(const Value* other) const {
///////////////////// BinaryValue ////////////////////
+BinaryValue::~BinaryValue() {
+ DCHECK(buffer_);
+ if (buffer_)
+ delete[] buffer_;
+}
+
// static
BinaryValue* BinaryValue::Create(char* buffer, size_t size) {
if (!buffer)
@@ -282,20 +288,6 @@ BinaryValue* BinaryValue::CreateWithCopiedBuffer(const char* buffer,
return new BinaryValue(buffer_copy, size);
}
-
-BinaryValue::BinaryValue(char* buffer, size_t size)
- : Value(TYPE_BINARY),
- buffer_(buffer),
- size_(size) {
- DCHECK(buffer_);
-}
-
-BinaryValue::~BinaryValue() {
- DCHECK(buffer_);
- if (buffer_)
- delete[] buffer_;
-}
-
Value* BinaryValue::DeepCopy() const {
return CreateWithCopiedBuffer(buffer_, size_);
}
@@ -309,6 +301,13 @@ bool BinaryValue::Equals(const Value* other) const {
return !memcmp(buffer_, other_binary->buffer_, size_);
}
+BinaryValue::BinaryValue(char* buffer, size_t size)
+ : Value(TYPE_BINARY),
+ buffer_(buffer),
+ size_(size) {
+ DCHECK(buffer_);
+}
+
///////////////////// DictionaryValue ////////////////////
DictionaryValue::DictionaryValue()
@@ -319,44 +318,6 @@ DictionaryValue::~DictionaryValue() {
Clear();
}
-Value* DictionaryValue::DeepCopy() const {
- DictionaryValue* result = new DictionaryValue;
-
- for (ValueMap::const_iterator current_entry(dictionary_.begin());
- current_entry != dictionary_.end(); ++current_entry) {
- result->SetWithoutPathExpansion(current_entry->first,
- current_entry->second->DeepCopy());
- }
-
- return result;
-}
-
-bool DictionaryValue::Equals(const Value* other) const {
- if (other->GetType() != GetType())
- return false;
-
- const DictionaryValue* other_dict =
- static_cast<const DictionaryValue*>(other);
- key_iterator lhs_it(begin_keys());
- key_iterator rhs_it(other_dict->begin_keys());
- while (lhs_it != end_keys() && rhs_it != other_dict->end_keys()) {
- Value* lhs;
- Value* rhs;
- if (*lhs_it != *rhs_it ||
- !GetWithoutPathExpansion(*lhs_it, &lhs) ||
- !other_dict->GetWithoutPathExpansion(*rhs_it, &rhs) ||
- !lhs->Equals(rhs)) {
- return false;
- }
- ++lhs_it;
- ++rhs_it;
- }
- if (lhs_it != end_keys() || rhs_it != other_dict->end_keys())
- return false;
-
- return true;
-}
-
bool DictionaryValue::HasKey(const std::string& key) const {
DCHECK(IsStringUTF8(key));
ValueMap::const_iterator current_entry = dictionary_.find(key);
@@ -685,6 +646,44 @@ void DictionaryValue::MergeDictionary(const DictionaryValue* dictionary) {
}
}
+Value* DictionaryValue::DeepCopy() const {
+ DictionaryValue* result = new DictionaryValue;
+
+ for (ValueMap::const_iterator current_entry(dictionary_.begin());
+ current_entry != dictionary_.end(); ++current_entry) {
+ result->SetWithoutPathExpansion(current_entry->first,
+ current_entry->second->DeepCopy());
+ }
+
+ return result;
+}
+
+bool DictionaryValue::Equals(const Value* other) const {
+ if (other->GetType() != GetType())
+ return false;
+
+ const DictionaryValue* other_dict =
+ static_cast<const DictionaryValue*>(other);
+ key_iterator lhs_it(begin_keys());
+ key_iterator rhs_it(other_dict->begin_keys());
+ while (lhs_it != end_keys() && rhs_it != other_dict->end_keys()) {
+ Value* lhs;
+ Value* rhs;
+ if (*lhs_it != *rhs_it ||
+ !GetWithoutPathExpansion(*lhs_it, &lhs) ||
+ !other_dict->GetWithoutPathExpansion(*rhs_it, &rhs) ||
+ !lhs->Equals(rhs)) {
+ return false;
+ }
+ ++lhs_it;
+ ++rhs_it;
+ }
+ if (lhs_it != end_keys() || rhs_it != other_dict->end_keys())
+ return false;
+
+ return true;
+}
+
///////////////////// ListValue ////////////////////
ListValue::ListValue() : Value(TYPE_LIST) {
« no previous file with comments | « base/task_queue.cc ('k') | base/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698