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

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

Issue 11458003: Remove scoped_refptr::release which is confusing and causes leaks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac Created 8 years 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/dom_storage/dom_storage_context.h" 5 #include "webkit/dom_storage/dom_storage_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 28 matching lines...) Expand all
39 // AtomicSequenceNum starts at 0 but we want to start session 39 // AtomicSequenceNum starts at 0 but we want to start session
40 // namespace ids at one since zero is reserved for the 40 // namespace ids at one since zero is reserved for the
41 // kLocalStorageNamespaceId. 41 // kLocalStorageNamespaceId.
42 session_id_sequence_.GetNext(); 42 session_id_sequence_.GetNext();
43 } 43 }
44 44
45 DomStorageContext::~DomStorageContext() { 45 DomStorageContext::~DomStorageContext() {
46 if (session_storage_database_.get()) { 46 if (session_storage_database_.get()) {
47 // SessionStorageDatabase shouldn't be deleted right away: deleting it will 47 // SessionStorageDatabase shouldn't be deleted right away: deleting it will
48 // potentially involve waiting in leveldb::DBImpl::~DBImpl, and waiting 48 // potentially involve waiting in leveldb::DBImpl::~DBImpl, and waiting
49 // shouldn't happen on this thread. This will unassign the ref counted 49 // shouldn't happen on this thread.
50 // pointer without decreasing the ref count, and is balanced by the Release 50 session_storage_database_->AddRef();
michaeln 2012/12/06 00:26:12 Same raciness here as mentioned before.
piman 2012/12/06 04:56:27 Done.
51 // that happens later.
52 task_runner_->PostShutdownBlockingTask( 51 task_runner_->PostShutdownBlockingTask(
53 FROM_HERE, 52 FROM_HERE,
54 DomStorageTaskRunner::COMMIT_SEQUENCE, 53 DomStorageTaskRunner::COMMIT_SEQUENCE,
55 base::Bind(&SessionStorageDatabase::Release, 54 base::Bind(&SessionStorageDatabase::Release,
56 base::Unretained(session_storage_database_.release()))); 55 base::Unretained(session_storage_database_.get())));
57 } 56 }
58 } 57 }
59 58
60 DomStorageNamespace* DomStorageContext::GetStorageNamespace( 59 DomStorageNamespace* DomStorageContext::GetStorageNamespace(
61 int64 namespace_id) { 60 int64 namespace_id) {
62 if (is_shutdown_) 61 if (is_shutdown_)
63 return NULL; 62 return NULL;
64 StorageNamespaceMap::iterator found = namespaces_.find(namespace_id); 63 StorageNamespaceMap::iterator found = namespaces_.find(namespace_id);
65 if (found == namespaces_.end()) { 64 if (found == namespaces_.end()) {
66 if (namespace_id == kLocalStorageNamespaceId) { 65 if (namespace_id == kLocalStorageNamespaceId) {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 if (!deletable_persistent_namespace_ids_.empty()) { 413 if (!deletable_persistent_namespace_ids_.empty()) {
415 task_runner_->PostDelayedTask( 414 task_runner_->PostDelayedTask(
416 FROM_HERE, base::Bind( 415 FROM_HERE, base::Bind(
417 &DomStorageContext::DeleteNextUnusedNamespace, 416 &DomStorageContext::DeleteNextUnusedNamespace,
418 this), 417 this),
419 base::TimeDelta::FromSeconds(kSessionStoraceScavengingSeconds)); 418 base::TimeDelta::FromSeconds(kSessionStoraceScavengingSeconds));
420 } 419 }
421 } 420 }
422 421
423 } // namespace dom_storage 422 } // namespace dom_storage
OLDNEW
« chrome/browser/extensions/api/page_capture/page_capture_api.cc ('K') | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698