summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorgavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-23 22:14:24 +0000
committergavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-23 22:14:24 +0000
commit15f5db6cc7c82ef59eabaaef2d1487150e9a4f59 (patch)
treef2fefb62c70cb28f202d5e73ff7b97baeb1c36b3 /net
parent7b5889271403aeca3ae850c0d99b474a048cebee (diff)
downloadchromium_src-15f5db6cc7c82ef59eabaaef2d1487150e9a4f59.zip
chromium_src-15f5db6cc7c82ef59eabaaef2d1487150e9a4f59.tar.gz
chromium_src-15f5db6cc7c82ef59eabaaef2d1487150e9a4f59.tar.bz2
Additional DCHECK for InFlightIO::InvokeCallback.
I'm interested in InFlightIO::io_list_, which is of type std::set<scoped_refptr<BackgroundIO> >, so it holds refs to the underlying objects. On the primary/callback thread, the erase call in InFlightIO::InvokeCallback can delete the operation if the list holds the last reference. This typically can't happen because the pending tasks hold a reference to the operation; this is good: it means that operations are deleted/newed on the background thread, I believe. This DCHECK() is useful for when you make changes that can delete an operation in the primary thread, like we found with some of the posix races in http://codereview.chromium.org/9702059/ Question: for debugging I like the use of scoped_refptr<BackgroundIO>; but since we never want to delete here, wouldn't a set<BackgroundIO*> on non-debug builds be more in line with our use? BUG=None Review URL: http://codereview.chromium.org/9758002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128593 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/disk_cache/in_flight_io.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/disk_cache/in_flight_io.cc b/net/disk_cache/in_flight_io.cc
index 636cb4f..86c2dcc 100644
--- a/net/disk_cache/in_flight_io.cc
+++ b/net/disk_cache/in_flight_io.cc
@@ -91,6 +91,7 @@ void InFlightIO::InvokeCallback(BackgroundIO* operation, bool cancel_task) {
// Make sure that we remove the operation from the list before invoking the
// callback (so that a subsequent cancel does not invoke the callback again).
DCHECK(io_list_.find(operation) != io_list_.end());
+ DCHECK(!operation->HasOneRef());
io_list_.erase(make_scoped_refptr(operation));
OnOperationComplete(operation, cancel_task);
}