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

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: Rebased again Created 3 years, 5 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 const char kAcceptHeader[] = "Accept"; 47 const char kAcceptHeader[] = "Accept";
48 const char kFrameAcceptHeader[] = 48 const char kFrameAcceptHeader[] =
49 "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp," 49 "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,"
50 "image/apng,*/*;q=0.8"; 50 "image/apng,*/*;q=0.8";
51 const char kStylesheetAcceptHeader[] = "text/css,*/*;q=0.1"; 51 const char kStylesheetAcceptHeader[] = "text/css,*/*;q=0.1";
52 const char kImageAcceptHeader[] = "image/webp,image/apng,image/*,*/*;q=0.8"; 52 const char kImageAcceptHeader[] = "image/webp,image/apng,image/*,*/*;q=0.8";
53 const char kDefaultAcceptHeader[] = "*/*"; 53 const char kDefaultAcceptHeader[] = "*/*";
54 54
55 // Used to write into an existing IOBuffer at a given offset. 55 // Used to write into an existing IOBuffer at a given offset.
56 class DependentIOBuffer : public net::WrappedIOBuffer { 56 class DependentIOBufferBar : public net::WrappedIOBuffer {
57 public: 57 public:
58 DependentIOBuffer(net::IOBuffer* buf, int offset) 58 DependentIOBufferBar(net::IOBuffer* buf, int offset)
59 : net::WrappedIOBuffer(buf->data() + offset), buf_(buf) {} 59 : net::WrappedIOBuffer(buf->data() + offset), buf_(buf) {}
60 60
61 private: 61 private:
62 ~DependentIOBuffer() override {} 62 ~DependentIOBufferBar() override {}
63 63
64 scoped_refptr<net::IOBuffer> buf_; 64 scoped_refptr<net::IOBuffer> buf_;
65 }; 65 };
66 66
67 } // namespace 67 } // namespace
68 68
69 class MimeSniffingResourceHandler::Controller : public ResourceController { 69 class MimeSniffingResourceHandler::Controller : public ResourceController {
70 public: 70 public:
71 explicit Controller(MimeSniffingResourceHandler* mime_handler) 71 explicit Controller(MimeSniffingResourceHandler* mime_handler)
72 : mime_handler_(mime_handler) {} 72 : mime_handler_(mime_handler) {}
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 if (state_ == STATE_STREAMING) { 229 if (state_ == STATE_STREAMING) {
230 next_handler_->OnWillRead(buf, buf_size, std::move(controller)); 230 next_handler_->OnWillRead(buf, buf_size, std::move(controller));
231 return; 231 return;
232 } 232 }
233 233
234 DCHECK_EQ(State::STATE_BUFFERING, state_); 234 DCHECK_EQ(State::STATE_BUFFERING, state_);
235 235
236 if (read_buffer_.get()) { 236 if (read_buffer_.get()) {
237 CHECK_LT(bytes_read_, read_buffer_size_); 237 CHECK_LT(bytes_read_, read_buffer_size_);
238 *buf = new DependentIOBuffer(read_buffer_.get(), bytes_read_); 238 *buf = new DependentIOBufferBar(read_buffer_.get(), bytes_read_);
239 *buf_size = read_buffer_size_ - bytes_read_; 239 *buf_size = read_buffer_size_ - bytes_read_;
240 controller->Resume(); 240 controller->Resume();
241 return; 241 return;
242 } 242 }
243 243
244 DCHECK(!read_buffer_size_); 244 DCHECK(!read_buffer_size_);
245 245
246 parent_read_buffer_ = buf; 246 parent_read_buffer_ = buf;
247 parent_read_buffer_size_ = buf_size; 247 parent_read_buffer_size_ = buf_size;
248 248
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 603
604 void MimeSniffingResourceHandler::OnPluginsLoaded( 604 void MimeSniffingResourceHandler::OnPluginsLoaded(
605 const std::vector<WebPluginInfo>& plugins) { 605 const std::vector<WebPluginInfo>& plugins) {
606 // No longer blocking on the plugins being loaded. 606 // No longer blocking on the plugins being loaded.
607 request()->LogUnblocked(); 607 request()->LogUnblocked();
608 if (state_ == STATE_BUFFERING) 608 if (state_ == STATE_BUFFERING)
609 AdvanceState(); 609 AdvanceState();
610 } 610 }
611 611
612 } // namespace content 612 } // 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