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

Unified Diff: net/base/file_stream_win.cc

Issue 6649012: Add ThreadRestrictions to FileStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nit. Created 9 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
« no previous file with comments | « net/base/file_stream_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/file_stream_win.cc
diff --git a/net/base/file_stream_win.cc b/net/base/file_stream_win.cc
index 9408ae0686e40f53c49f614bd5a0eb5c80ff6a5e..f90204244090796bd2450e780bdeb3bccff4fee6 100644
--- a/net/base/file_stream_win.cc
+++ b/net/base/file_stream_win.cc
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
+#include "base/threading/thread_restrictions.h"
#include "net/base/net_errors.h"
namespace net {
@@ -198,6 +199,8 @@ int64 FileStream::Seek(Whence whence, int64 offset) {
}
int64 FileStream::Available() {
+ base::ThreadRestrictions::AssertIOAllowed();
+
if (!IsOpen())
return ERR_UNEXPECTED;
@@ -223,8 +226,12 @@ int FileStream::Read(
OVERLAPPED* overlapped = NULL;
if (async_context_.get()) {
+ DCHECK(callback);
DCHECK(!async_context_->callback());
overlapped = async_context_->overlapped();
+ } else {
+ DCHECK(!callback);
+ base::ThreadRestrictions::AssertIOAllowed();
}
int rv;
@@ -279,8 +286,12 @@ int FileStream::Write(
OVERLAPPED* overlapped = NULL;
if (async_context_.get()) {
+ DCHECK(callback);
DCHECK(!async_context_->callback());
overlapped = async_context_->overlapped();
+ } else {
+ DCHECK(!callback);
+ base::ThreadRestrictions::AssertIOAllowed();
}
int rv;
@@ -304,6 +315,8 @@ int FileStream::Write(
}
int FileStream::Flush() {
+ base::ThreadRestrictions::AssertIOAllowed();
+
if (!IsOpen())
return ERR_UNEXPECTED;
@@ -319,6 +332,8 @@ int FileStream::Flush() {
}
int64 FileStream::Truncate(int64 bytes) {
+ base::ThreadRestrictions::AssertIOAllowed();
+
if (!IsOpen())
return ERR_UNEXPECTED;
« no previous file with comments | « net/base/file_stream_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698