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

Unified Diff: net/disk_cache/in_flight_io.h

Issue 9702059: Disk cache: Remove all non essential synchronization from the cache destructor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: net/disk_cache/in_flight_io.h
===================================================================
--- net/disk_cache/in_flight_io.h (revision 126788)
+++ net/disk_cache/in_flight_io.h (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,7 @@
#include <set>
#include "base/message_loop_proxy.h"
+#include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h"
namespace disk_cache {
@@ -48,18 +49,19 @@
protected:
virtual ~BackgroundIO();
- InFlightIO* controller_; // The controller that tracks all operations.
+ // Notifies the controller about the end of the operation, from the background
+ // thread.
+ void NotifyController();
+
int result_; // Final operation result.
private:
friend class base::RefCountedThreadSafe<BackgroundIO>;
- // Notifies the controller about the end of the operation, from the background
- // thread.
- void NotifyController();
-
// An event to signal when the operation completes.
base::WaitableEvent io_completed_;
+ InFlightIO* controller_; // The controller that tracks all operations.
+ base::Lock controller_lock_; // A lock protecting clearing of controller_.
DISALLOW_COPY_AND_ASSIGN(BackgroundIO);
};
@@ -95,6 +97,9 @@
// complete.
void WaitForPendingIO();
+ // Drops current pending operation without waiting for them to complete.
+ void DropPendingIO();
+
// Called on a background thread when |operation| completes.
void OnIOComplete(BackgroundIO* operation);

Powered by Google App Engine
This is Rietveld 408576698