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

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

Issue 2867693004: Snapshot of all changes to get jumbo in blink and content.
Patch Set: Exclude certain files from jumbo because of a Windows problem Created 3 years, 3 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
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/mime_sniffing_resource_handler.h" 5 #include "content/browser/loader/mime_sniffing_resource_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 const char kAcceptHeader[] = "Accept"; 48 const char kAcceptHeader[] = "Accept";
49 const char kFrameAcceptHeader[] = 49 const char kFrameAcceptHeader[] =
50 "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp," 50 "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,"
51 "image/apng,*/*;q=0.8"; 51 "image/apng,*/*;q=0.8";
52 const char kStylesheetAcceptHeader[] = "text/css,*/*;q=0.1"; 52 const char kStylesheetAcceptHeader[] = "text/css,*/*;q=0.1";
53 const char kImageAcceptHeader[] = "image/webp,image/apng,image/*,*/*;q=0.8"; 53 const char kImageAcceptHeader[] = "image/webp,image/apng,image/*,*/*;q=0.8";
54 const char kDefaultAcceptHeader[] = "*/*"; 54 const char kDefaultAcceptHeader[] = "*/*";
55 55
56 // Used to write into an existing IOBuffer at a given offset. 56 // Used to write into an existing IOBuffer at a given offset.
57 class DependentIOBuffer : public net::WrappedIOBuffer { 57 class DependentIOBufferBar : public net::WrappedIOBuffer {
58 public: 58 public:
59 DependentIOBuffer(net::IOBuffer* buf, int offset) 59 DependentIOBufferBar(net::IOBuffer* buf, int offset)
60 : net::WrappedIOBuffer(buf->data() + offset), buf_(buf) {} 60 : net::WrappedIOBuffer(buf->data() + offset), buf_(buf) {}
61 61
62 private: 62 private:
63 ~DependentIOBuffer() override {} 63 ~DependentIOBufferBar() override {}
64 64
65 scoped_refptr<net::IOBuffer> buf_; 65 scoped_refptr<net::IOBuffer> buf_;
66 }; 66 };
67 67
68 } // namespace 68 } // namespace
69 69
70 class MimeSniffingResourceHandler::Controller : public ResourceController { 70 class MimeSniffingResourceHandler::Controller : public ResourceController {
71 public: 71 public:
72 explicit Controller(MimeSniffingResourceHandler* mime_handler) 72 explicit Controller(MimeSniffingResourceHandler* mime_handler)
73 : mime_handler_(mime_handler) {} 73 : mime_handler_(mime_handler) {}
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 if (state_ == STATE_STREAMING) { 227 if (state_ == STATE_STREAMING) {
228 next_handler_->OnWillRead(buf, buf_size, std::move(controller)); 228 next_handler_->OnWillRead(buf, buf_size, std::move(controller));
229 return; 229 return;
230 } 230 }
231 231
232 DCHECK_EQ(State::STATE_BUFFERING, state_); 232 DCHECK_EQ(State::STATE_BUFFERING, state_);
233 233
234 if (read_buffer_.get()) { 234 if (read_buffer_.get()) {
235 CHECK_LT(bytes_read_, read_buffer_size_); 235 CHECK_LT(bytes_read_, read_buffer_size_);
236 *buf = new DependentIOBuffer(read_buffer_.get(), bytes_read_); 236 *buf = new DependentIOBufferBar(read_buffer_.get(), bytes_read_);
237 *buf_size = read_buffer_size_ - bytes_read_; 237 *buf_size = read_buffer_size_ - bytes_read_;
238 controller->Resume(); 238 controller->Resume();
239 return; 239 return;
240 } 240 }
241 241
242 DCHECK(!read_buffer_size_); 242 DCHECK(!read_buffer_size_);
243 243
244 parent_read_buffer_ = buf; 244 parent_read_buffer_ = buf;
245 parent_read_buffer_size_ = buf_size; 245 parent_read_buffer_size_ = buf_size;
246 246
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 573
574 void MimeSniffingResourceHandler::OnPluginsLoaded( 574 void MimeSniffingResourceHandler::OnPluginsLoaded(
575 const std::vector<WebPluginInfo>& plugins) { 575 const std::vector<WebPluginInfo>& plugins) {
576 // No longer blocking on the plugins being loaded. 576 // No longer blocking on the plugins being loaded.
577 request()->LogUnblocked(); 577 request()->LogUnblocked();
578 if (state_ == STATE_BUFFERING) 578 if (state_ == STATE_BUFFERING)
579 AdvanceState(); 579 AdvanceState();
580 } 580 }
581 581
582 } // namespace content 582 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/async_resource_handler.cc ('k') | content/browser/loader/navigation_url_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698