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

Side by Side Diff: webkit/dom_storage/dom_storage_area.cc

Issue 11028110: This CL demonstrates some weird browser_test behavior on linux_chromeos. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: whereas this works as expected Created 8 years, 2 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
« no previous file with comments | « webkit/dom_storage/dom_storage_area.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/dom_storage/dom_storage_area.h" 5 #include "webkit/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/time.h" 10 #include "base/time.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
12 #include "webkit/database/database_util.h" 12 #include "webkit/database/database_util.h"
13 #include "webkit/dom_storage/dom_storage_map.h" 13 #include "webkit/dom_storage/dom_storage_map.h"
14 #include "webkit/dom_storage/dom_storage_namespace.h" 14 #include "webkit/dom_storage/dom_storage_namespace.h"
15 #include "webkit/dom_storage/dom_storage_task_runner.h" 15 #include "webkit/dom_storage/dom_storage_task_runner.h"
16 #include "webkit/dom_storage/dom_storage_types.h" 16 #include "webkit/dom_storage/dom_storage_types.h"
17 #include "webkit/dom_storage/local_storage_database_adapter.h" 17 #include "webkit/dom_storage/local_storage_database_adapter.h"
18 #include "webkit/dom_storage/session_storage_database.h" 18 #include "webkit/dom_storage/session_storage_database.h"
19 #include "webkit/dom_storage/session_storage_database_adapter.h" 19 #include "webkit/dom_storage/session_storage_database_adapter.h"
20 #include "webkit/fileapi/file_system_util.h" 20 #include "webkit/fileapi/file_system_util.h"
21 #include "webkit/glue/webkit_glue.h" 21 #include "webkit/glue/webkit_glue.h"
22 22
23 using webkit_database::DatabaseUtil; 23 using webkit_database::DatabaseUtil;
24 24
25 namespace dom_storage { 25 namespace dom_storage {
26 26
27 static const int kCommitTimerSeconds = 1; 27 static const int kCommitTimerSeconds = 1;
28 28
29 int DomStorageArea::set_me = 2;
30
29 DomStorageArea::CommitBatch::CommitBatch() 31 DomStorageArea::CommitBatch::CommitBatch()
30 : clear_all_first(false) { 32 : clear_all_first(false) {
31 } 33 }
32 DomStorageArea::CommitBatch::~CommitBatch() {} 34 DomStorageArea::CommitBatch::~CommitBatch() {}
33 35
34 36
35 // static 37 // static
36 const FilePath::CharType DomStorageArea::kDatabaseFileExtension[] = 38 const FilePath::CharType DomStorageArea::kDatabaseFileExtension[] =
37 FILE_PATH_LITERAL(".localstorage"); 39 FILE_PATH_LITERAL(".localstorage");
38 40
(...skipping 17 matching lines...) Expand all
56 58
57 DomStorageArea::DomStorageArea(const GURL& origin, const FilePath& directory, 59 DomStorageArea::DomStorageArea(const GURL& origin, const FilePath& directory,
58 DomStorageTaskRunner* task_runner) 60 DomStorageTaskRunner* task_runner)
59 : namespace_id_(kLocalStorageNamespaceId), origin_(origin), 61 : namespace_id_(kLocalStorageNamespaceId), origin_(origin),
60 directory_(directory), 62 directory_(directory),
61 task_runner_(task_runner), 63 task_runner_(task_runner),
62 map_(new DomStorageMap(kPerAreaQuota + kPerAreaOverQuotaAllowance)), 64 map_(new DomStorageMap(kPerAreaQuota + kPerAreaOverQuotaAllowance)),
63 is_initial_import_done_(true), 65 is_initial_import_done_(true),
64 is_shutdown_(false), 66 is_shutdown_(false),
65 commit_batches_in_flight_(0) { 67 commit_batches_in_flight_(0) {
68 LOG(ERROR) << "DomStorageArea ctor, set_me " << set_me << ", pid: "
69 << getpid();
66 if (!directory.empty()) { 70 if (!directory.empty()) {
67 FilePath path = directory.Append(DatabaseFileNameFromOrigin(origin_)); 71 FilePath path = directory.Append(DatabaseFileNameFromOrigin(origin_));
68 backing_.reset(new LocalStorageDatabaseAdapter(path)); 72 backing_.reset(new LocalStorageDatabaseAdapter(path));
69 is_initial_import_done_ = false; 73 is_initial_import_done_ = false;
70 } 74 }
71 } 75 }
72 76
73 DomStorageArea::DomStorageArea( 77 DomStorageArea::DomStorageArea(
74 int64 namespace_id, 78 int64 namespace_id,
75 const std::string& persistent_namespace_id, 79 const std::string& persistent_namespace_id,
76 const GURL& origin, 80 const GURL& origin,
77 SessionStorageDatabase* session_storage_backing, 81 SessionStorageDatabase* session_storage_backing,
78 DomStorageTaskRunner* task_runner) 82 DomStorageTaskRunner* task_runner)
79 : namespace_id_(namespace_id), 83 : namespace_id_(namespace_id),
80 persistent_namespace_id_(persistent_namespace_id), 84 persistent_namespace_id_(persistent_namespace_id),
81 origin_(origin), 85 origin_(origin),
82 task_runner_(task_runner), 86 task_runner_(task_runner),
83 map_(new DomStorageMap(kPerAreaQuota + kPerAreaOverQuotaAllowance)), 87 map_(new DomStorageMap(kPerAreaQuota + kPerAreaOverQuotaAllowance)),
84 session_storage_backing_(session_storage_backing), 88 session_storage_backing_(session_storage_backing),
85 is_initial_import_done_(true), 89 is_initial_import_done_(true),
86 is_shutdown_(false), 90 is_shutdown_(false),
87 commit_batches_in_flight_(0) { 91 commit_batches_in_flight_(0) {
92 LOG(ERROR) << "DomStorageArea ctor, set_me " << set_me << ", pid: "
93 << getpid();
88 DCHECK(namespace_id != kLocalStorageNamespaceId); 94 DCHECK(namespace_id != kLocalStorageNamespaceId);
89 if (session_storage_backing) { 95 if (session_storage_backing) {
90 backing_.reset(new SessionStorageDatabaseAdapter( 96 backing_.reset(new SessionStorageDatabaseAdapter(
91 session_storage_backing, persistent_namespace_id, origin)); 97 session_storage_backing, persistent_namespace_id, origin));
92 is_initial_import_done_ = false; 98 is_initial_import_done_ = false;
93 } 99 }
94 } 100 }
95 101
96 DomStorageArea::~DomStorageArea() { 102 DomStorageArea::~DomStorageArea() {
97 } 103 }
(...skipping 22 matching lines...) Expand all
120 NullableString16 DomStorageArea::GetItem(const string16& key) { 126 NullableString16 DomStorageArea::GetItem(const string16& key) {
121 if (is_shutdown_) 127 if (is_shutdown_)
122 return NullableString16(true); 128 return NullableString16(true);
123 InitialImportIfNeeded(); 129 InitialImportIfNeeded();
124 return map_->GetItem(key); 130 return map_->GetItem(key);
125 } 131 }
126 132
127 bool DomStorageArea::SetItem(const string16& key, 133 bool DomStorageArea::SetItem(const string16& key,
128 const string16& value, 134 const string16& value,
129 NullableString16* old_value) { 135 NullableString16* old_value) {
136 LOG(ERROR) << "DomStorageArea::SetItem, set_me " << set_me << ", pid: "
137 << getpid();
138 LOG(ERROR) << "address of set_me: " << &dom_storage::DomStorageArea::set_me;
130 if (is_shutdown_) 139 if (is_shutdown_)
131 return false; 140 return false;
132 InitialImportIfNeeded(); 141 InitialImportIfNeeded();
133 if (!map_->HasOneRef()) 142 if (!map_->HasOneRef())
134 map_ = map_->DeepCopy(); 143 map_ = map_->DeepCopy();
135 bool success = map_->SetItem(key, value, old_value); 144 bool success = map_->SetItem(key, value, old_value);
136 if (success && backing_.get()) { 145 if (success && backing_.get()) {
137 CommitBatch* commit_batch = CreateCommitBatchIfNeeded(); 146 CommitBatch* commit_batch = CreateCommitBatchIfNeeded();
138 commit_batch->changed_values[key] = NullableString16(value, false); 147 commit_batch->changed_values[key] = NullableString16(value, false);
139 } 148 }
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 commit_batch_->clear_all_first, 348 commit_batch_->clear_all_first,
340 commit_batch_->changed_values); 349 commit_batch_->changed_values);
341 DCHECK(success); 350 DCHECK(success);
342 } 351 }
343 commit_batch_.reset(); 352 commit_batch_.reset();
344 backing_.reset(); 353 backing_.reset();
345 session_storage_backing_ = NULL; 354 session_storage_backing_ = NULL;
346 } 355 }
347 356
348 } // namespace dom_storage 357 } // namespace dom_storage
OLDNEW
« no previous file with comments | « webkit/dom_storage/dom_storage_area.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698