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

Side by Side Diff: trunk/src/content/browser/loader/stream_resource_handler.cc

Issue 26472004: Revert 227318 "Clean up ResourceHandler API." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 2 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/stream_resource_handler.h" 5 #include "content/browser/loader/stream_resource_handler.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/browser/streams/stream.h" 9 #include "content/browser/streams/stream.h"
10 #include "content/browser/streams/stream_registry.h" 10 #include "content/browser/streams/stream_registry.h"
11 #include "content/public/browser/resource_controller.h" 11 #include "content/public/browser/resource_controller.h"
12 #include "content/public/common/url_constants.h" 12 #include "content/public/common/url_constants.h"
13 #include "net/base/io_buffer.h" 13 #include "net/base/io_buffer.h"
14 #include "net/url_request/url_request_status.h" 14 #include "net/url_request/url_request_status.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 StreamResourceHandler::StreamResourceHandler( 18 StreamResourceHandler::StreamResourceHandler(
19 net::URLRequest* request, 19 net::URLRequest* request,
20 StreamRegistry* registry, 20 StreamRegistry* registry,
21 const GURL& origin) 21 const GURL& origin)
22 : ResourceHandler(request), 22 : request_(request),
23 read_buffer_(NULL) { 23 read_buffer_(NULL) {
24 // TODO(tyoshino): Find a way to share this with the blob URL creation in 24 // TODO(tyoshino): Find a way to share this with the blob URL creation in
25 // WebKit. 25 // WebKit.
26 GURL url(std::string(chrome::kBlobScheme) + ":" + 26 GURL url(std::string(chrome::kBlobScheme) + ":" +
27 origin.spec() + base::GenerateGUID()); 27 origin.spec() + base::GenerateGUID());
28 stream_ = new Stream(registry, this, url); 28 stream_ = new Stream(registry, this, url);
29 } 29 }
30 30
31 StreamResourceHandler::~StreamResourceHandler() { 31 StreamResourceHandler::~StreamResourceHandler() {
32 stream_->RemoveWriteObserver(this); 32 stream_->RemoveWriteObserver(this);
(...skipping 18 matching lines...) Expand all
51 return true; 51 return true;
52 } 52 }
53 53
54 bool StreamResourceHandler::OnWillStart(int request_id, 54 bool StreamResourceHandler::OnWillStart(int request_id,
55 const GURL& url, 55 const GURL& url,
56 bool* defer) { 56 bool* defer) {
57 return true; 57 return true;
58 } 58 }
59 59
60 bool StreamResourceHandler::OnWillRead(int request_id, 60 bool StreamResourceHandler::OnWillRead(int request_id,
61 scoped_refptr<net::IOBuffer>* buf, 61 net::IOBuffer** buf,
62 int* buf_size, 62 int* buf_size,
63 int min_size) { 63 int min_size) {
64 static const int kReadBufSize = 32768; 64 static const int kReadBufSize = 32768;
65 65
66 DCHECK(buf && buf_size); 66 DCHECK(buf && buf_size);
67 if (!read_buffer_.get()) 67 if (!read_buffer_.get())
68 read_buffer_ = new net::IOBuffer(kReadBufSize); 68 read_buffer_ = new net::IOBuffer(kReadBufSize);
69 *buf = read_buffer_.get(); 69 *buf = read_buffer_.get();
70 *buf_size = kReadBufSize; 70 *buf_size = kReadBufSize;
71 71
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 void StreamResourceHandler::OnSpaceAvailable(Stream* stream) { 110 void StreamResourceHandler::OnSpaceAvailable(Stream* stream) {
111 controller()->Resume(); 111 controller()->Resume();
112 } 112 }
113 113
114 void StreamResourceHandler::OnClose(Stream* stream) { 114 void StreamResourceHandler::OnClose(Stream* stream) {
115 controller()->Cancel(); 115 controller()->Cancel();
116 } 116 }
117 117
118 } // namespace content 118 } // namespace content
OLDNEW
« no previous file with comments | « trunk/src/content/browser/loader/stream_resource_handler.h ('k') | trunk/src/content/browser/loader/sync_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698