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

Side by Side Diff: content/browser/dom_storage/dom_storage_area.cc

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build Created 6 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/dom_storage/dom_storage_area.h" 5 #include "content/browser/dom_storage/dom_storage_area.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "content/browser/dom_storage/dom_storage_namespace.h" 13 #include "content/browser/dom_storage/dom_storage_namespace.h"
14 #include "content/browser/dom_storage/dom_storage_task_runner.h" 14 #include "content/browser/dom_storage/dom_storage_task_runner.h"
15 #include "content/browser/dom_storage/local_storage_database_adapter.h" 15 #include "content/browser/dom_storage/local_storage_database_adapter.h"
16 #include "content/browser/dom_storage/session_storage_database.h" 16 #include "content/browser/dom_storage/session_storage_database.h"
17 #include "content/browser/dom_storage/session_storage_database_adapter.h" 17 #include "content/browser/dom_storage/session_storage_database_adapter.h"
18 #include "content/common/dom_storage/dom_storage_map.h" 18 #include "content/common/dom_storage/dom_storage_map.h"
19 #include "content/common/dom_storage/dom_storage_types.h" 19 #include "content/common/dom_storage/dom_storage_types.h"
20 #include "webkit/browser/database/database_util.h" 20 #include "webkit/browser/database/database_util.h"
21 #include "webkit/common/database/database_identifier.h" 21 #include "webkit/common/database/database_identifier.h"
22 #include "webkit/common/fileapi/file_system_util.h" 22 #include "webkit/common/fileapi/file_system_util.h"
23 23
24 using webkit_database::DatabaseUtil; 24 using storage::DatabaseUtil;
25 25
26 namespace content { 26 namespace content {
27 27
28 static const int kCommitTimerSeconds = 1; 28 static const int kCommitTimerSeconds = 1;
29 29
30 DOMStorageArea::CommitBatch::CommitBatch() 30 DOMStorageArea::CommitBatch::CommitBatch()
31 : clear_all_first(false) { 31 : clear_all_first(false) {
32 } 32 }
33 DOMStorageArea::CommitBatch::~CommitBatch() {} 33 DOMStorageArea::CommitBatch::~CommitBatch() {}
34 34
35 35
36 // static 36 // static
37 const base::FilePath::CharType DOMStorageArea::kDatabaseFileExtension[] = 37 const base::FilePath::CharType DOMStorageArea::kDatabaseFileExtension[] =
38 FILE_PATH_LITERAL(".localstorage"); 38 FILE_PATH_LITERAL(".localstorage");
39 39
40 // static 40 // static
41 base::FilePath DOMStorageArea::DatabaseFileNameFromOrigin(const GURL& origin) { 41 base::FilePath DOMStorageArea::DatabaseFileNameFromOrigin(const GURL& origin) {
42 std::string filename = webkit_database::GetIdentifierFromOrigin(origin); 42 std::string filename = storage::GetIdentifierFromOrigin(origin);
43 // There is no base::FilePath.AppendExtension() method, so start with just the 43 // There is no base::FilePath.AppendExtension() method, so start with just the
44 // extension as the filename, and then InsertBeforeExtension the desired 44 // extension as the filename, and then InsertBeforeExtension the desired
45 // name. 45 // name.
46 return base::FilePath().Append(kDatabaseFileExtension). 46 return base::FilePath().Append(kDatabaseFileExtension).
47 InsertBeforeExtensionASCII(filename); 47 InsertBeforeExtensionASCII(filename);
48 } 48 }
49 49
50 // static 50 // static
51 GURL DOMStorageArea::OriginFromDatabaseFileName(const base::FilePath& name) { 51 GURL DOMStorageArea::OriginFromDatabaseFileName(const base::FilePath& name) {
52 DCHECK(name.MatchesExtension(kDatabaseFileExtension)); 52 DCHECK(name.MatchesExtension(kDatabaseFileExtension));
53 std::string origin_id = 53 std::string origin_id =
54 name.BaseName().RemoveExtension().MaybeAsASCII(); 54 name.BaseName().RemoveExtension().MaybeAsASCII();
55 return webkit_database::GetOriginFromIdentifier(origin_id); 55 return storage::GetOriginFromIdentifier(origin_id);
56 } 56 }
57 57
58 DOMStorageArea::DOMStorageArea( 58 DOMStorageArea::DOMStorageArea(
59 const GURL& origin, const base::FilePath& directory, 59 const GURL& origin, const base::FilePath& directory,
60 DOMStorageTaskRunner* task_runner) 60 DOMStorageTaskRunner* task_runner)
61 : namespace_id_(kLocalStorageNamespaceId), origin_(origin), 61 : namespace_id_(kLocalStorageNamespaceId), origin_(origin),
62 directory_(directory), 62 directory_(directory),
63 task_runner_(task_runner), 63 task_runner_(task_runner),
64 map_(new DOMStorageMap(kPerStorageAreaQuota + 64 map_(new DOMStorageMap(kPerStorageAreaQuota +
65 kPerStorageAreaOverQuotaAllowance)), 65 kPerStorageAreaOverQuotaAllowance)),
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 commit_batch_->clear_all_first, 395 commit_batch_->clear_all_first,
396 commit_batch_->changed_values); 396 commit_batch_->changed_values);
397 DCHECK(success); 397 DCHECK(success);
398 } 398 }
399 commit_batch_.reset(); 399 commit_batch_.reset();
400 backing_.reset(); 400 backing_.reset();
401 session_storage_backing_ = NULL; 401 session_storage_backing_ = NULL;
402 } 402 }
403 403
404 } // namespace content 404 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/renderer_overrides_handler.cc ('k') | content/browser/dom_storage/dom_storage_context_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698