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

Side by Side Diff: content/browser/loader/redirect_to_file_resource_handler.cc

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 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 "content/browser/loader/redirect_to_file_resource_handler.h" 5 #include "content/browser/loader/redirect_to_file_resource_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/threading/thread_restrictions.h" 9 #include "base/threading/thread_restrictions.h"
10 #include "content/browser/loader/resource_request_info_impl.h" 10 #include "content/browser/loader/resource_request_info_impl.h"
11 #include "content/browser/loader/temporary_file_stream.h" 11 #include "content/browser/loader/temporary_file_stream.h"
12 #include "content/public/browser/resource_controller.h" 12 #include "content/public/browser/resource_controller.h"
13 #include "content/public/common/resource_response.h" 13 #include "content/public/common/resource_response.h"
14 #include "net/base/file_stream.h" 14 #include "net/base/file_stream.h"
15 #include "net/base/io_buffer.h" 15 #include "net/base/io_buffer.h"
16 #include "net/base/mime_sniffer.h" 16 #include "net/base/mime_sniffer.h"
17 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
18 #include "webkit/common/blob/shareable_file_reference.h" 18 #include "storage/common/blob/shareable_file_reference.h"
19 19
20 using webkit_blob::ShareableFileReference; 20 using storage::ShareableFileReference;
21 21
22 namespace { 22 namespace {
23 23
24 // This class is similar to identically named classes in AsyncResourceHandler 24 // This class is similar to identically named classes in AsyncResourceHandler
25 // and BufferedResourceHandler, but not quite. 25 // and BufferedResourceHandler, but not quite.
26 // TODO(ncbray) generalize and unify these cases? 26 // TODO(ncbray) generalize and unify these cases?
27 // In general, it's a bad idea to point to a subbuffer (particularly with 27 // In general, it's a bad idea to point to a subbuffer (particularly with
28 // GrowableIOBuffer) because the backing IOBuffer may realloc its data. In this 28 // GrowableIOBuffer) because the backing IOBuffer may realloc its data. In this
29 // particular case we know RedirectToFileResourceHandler will not realloc its 29 // particular case we know RedirectToFileResourceHandler will not realloc its
30 // buffer while a write is occurring, so we should be safe. This property is 30 // buffer while a write is occurring, so we should be safe. This property is
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 delete this; 114 delete this;
115 } 115 }
116 116
117 RedirectToFileResourceHandler* handler_; 117 RedirectToFileResourceHandler* handler_;
118 118
119 scoped_ptr<net::FileStream> file_stream_; 119 scoped_ptr<net::FileStream> file_stream_;
120 bool is_writing_; 120 bool is_writing_;
121 121
122 // We create a ShareableFileReference that's deletable for the temp file 122 // We create a ShareableFileReference that's deletable for the temp file
123 // created as a result of the download. 123 // created as a result of the download.
124 scoped_refptr<webkit_blob::ShareableFileReference> deletable_file_; 124 scoped_refptr<storage::ShareableFileReference> deletable_file_;
125 125
126 DISALLOW_COPY_AND_ASSIGN(Writer); 126 DISALLOW_COPY_AND_ASSIGN(Writer);
127 }; 127 };
128 128
129 RedirectToFileResourceHandler::RedirectToFileResourceHandler( 129 RedirectToFileResourceHandler::RedirectToFileResourceHandler(
130 scoped_ptr<ResourceHandler> next_handler, 130 scoped_ptr<ResourceHandler> next_handler,
131 net::URLRequest* request) 131 net::URLRequest* request)
132 : LayeredResourceHandler(request, next_handler.Pass()), 132 : LayeredResourceHandler(request, next_handler.Pass()),
133 buf_(new net::GrowableIOBuffer()), 133 buf_(new net::GrowableIOBuffer()),
134 buf_write_pending_(false), 134 buf_write_pending_(false),
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 } 362 }
363 363
364 void RedirectToFileResourceHandler::ResumeIfDeferred() { 364 void RedirectToFileResourceHandler::ResumeIfDeferred() {
365 if (did_defer_) { 365 if (did_defer_) {
366 did_defer_ = false; 366 did_defer_ = false;
367 controller()->Resume(); 367 controller()->Resume();
368 } 368 }
369 } 369 }
370 370
371 } // namespace content 371 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/redirect_to_file_resource_handler.h ('k') | content/browser/loader/resource_dispatcher_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698