summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/url_request_mock_http_job.cc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-22 22:41:51 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-22 22:41:51 +0000
commit88328f582694565b00ea445c4541f37fa73f3539 (patch)
tree49f8d1db6ef50042e88e8fbde68bddc3663b6565 /chrome/browser/net/url_request_mock_http_job.cc
parent2c40ca906d025d38855eac463c17cb8e9b7b412e (diff)
downloadchromium_src-88328f582694565b00ea445c4541f37fa73f3539.zip
chromium_src-88328f582694565b00ea445c4541f37fa73f3539.tar.gz
chromium_src-88328f582694565b00ea445c4541f37fa73f3539.tar.bz2
Thread IO safety: annotate file_util, and block IO thread from doing IO
- Mark functions in file_util_posix as requiring permission to perform disk actions. - Mark the IO thread as disallowed from performing disk actions. - Temporarily work around the protections in places where we currently have bugs. BUG=59847,59849,60207,60211 TEST=no dchecks in debug builds Review URL: http://codereview.chromium.org/3872002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63580 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/url_request_mock_http_job.cc')
-rw-r--r--chrome/browser/net/url_request_mock_http_job.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/chrome/browser/net/url_request_mock_http_job.cc b/chrome/browser/net/url_request_mock_http_job.cc
index a35cd1e..4029605 100644
--- a/chrome/browser/net/url_request_mock_http_job.cc
+++ b/chrome/browser/net/url_request_mock_http_job.cc
@@ -7,6 +7,7 @@
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/string_util.h"
+#include "base/thread_restrictions.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/url_constants.h"
#include "net/base/net_util.h"
@@ -87,6 +88,10 @@ bool URLRequestMockHTTPJob::IsRedirectResponse(GURL* location,
// Private const version.
void URLRequestMockHTTPJob::GetResponseInfoConst(
net::HttpResponseInfo* info) const {
+ // We have to load our headers from disk, but we only use this class
+ // from tests, so allow these IO operations to happen on any thread.
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
+
FilePath header_file = FilePath(file_path_.value() + kMockHeaderFileSuffix);
std::string raw_headers;
if (!file_util::ReadFileToString(header_file, &raw_headers))