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

Side by Side Diff: webkit/browser/dom_storage/session_storage_database.cc

Issue 17327004: Replace base::NullableString16(bool) usage with default constructor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "webkit/browser/dom_storage/session_storage_database.h" 5 #include "webkit/browser/dom_storage/session_storage_database.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 // Skip the dummy entry "map-<mapid>-". 516 // Skip the dummy entry "map-<mapid>-".
517 for (it->Next(); it->Valid(); it->Next()) { 517 for (it->Next(); it->Valid(); it->Next()) {
518 std::string key = it->key().ToString(); 518 std::string key = it->key().ToString();
519 if (key.find(map_start_key) != 0) { 519 if (key.find(map_start_key) != 0) {
520 // Iterated past the keys in this map. 520 // Iterated past the keys in this map.
521 break; 521 break;
522 } 522 }
523 // Key is of the form "map-<mapid>-<key>". 523 // Key is of the form "map-<mapid>-<key>".
524 base::string16 key16 = UTF8ToUTF16(key.substr(map_start_key.length())); 524 base::string16 key16 = UTF8ToUTF16(key.substr(map_start_key.length()));
525 if (only_keys) { 525 if (only_keys) {
526 (*result)[key16] = base::NullableString16(true); 526 (*result)[key16] = base::NullableString16();
527 } else { 527 } else {
528 // Convert the raw data stored in std::string (it->value()) to raw data 528 // Convert the raw data stored in std::string (it->value()) to raw data
529 // stored in base::string16. 529 // stored in base::string16.
530 size_t len = it->value().size() / sizeof(char16); 530 size_t len = it->value().size() / sizeof(char16);
531 const char16* data_ptr = 531 const char16* data_ptr =
532 reinterpret_cast<const char16*>(it->value().data()); 532 reinterpret_cast<const char16*>(it->value().data());
533 (*result)[key16] = 533 (*result)[key16] =
534 base::NullableString16(base::string16(data_ptr, len), false); 534 base::NullableString16(base::string16(data_ptr, len), false);
535 } 535 }
536 } 536 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 std::string SessionStorageDatabase::MapKey(const std::string& map_id, 667 std::string SessionStorageDatabase::MapKey(const std::string& map_id,
668 const std::string& key) { 668 const std::string& key) {
669 return base::StringPrintf("map-%s-%s", map_id.c_str(), key.c_str()); 669 return base::StringPrintf("map-%s-%s", map_id.c_str(), key.c_str());
670 } 670 }
671 671
672 const char* SessionStorageDatabase::NextMapIdKey() { 672 const char* SessionStorageDatabase::NextMapIdKey() {
673 return "next-map-id"; 673 return "next-map-id";
674 } 674 }
675 675
676 } // namespace dom_storage 676 } // namespace dom_storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698