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

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

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return true; 56 return true;
57 } 57 }
58 58
59 bool StreamResourceHandler::OnWillRead(int request_id, 59 bool StreamResourceHandler::OnWillRead(int request_id,
60 net::IOBuffer** buf, 60 net::IOBuffer** buf,
61 int* buf_size, 61 int* buf_size,
62 int min_size) { 62 int min_size) {
63 static const int kReadBufSize = 32768; 63 static const int kReadBufSize = 32768;
64 64
65 DCHECK(buf && buf_size); 65 DCHECK(buf && buf_size);
66 if (!read_buffer_) 66 if (!read_buffer_.get())
67 read_buffer_ = new net::IOBuffer(kReadBufSize); 67 read_buffer_ = new net::IOBuffer(kReadBufSize);
68 *buf = read_buffer_.get(); 68 *buf = read_buffer_.get();
69 *buf_size = kReadBufSize; 69 *buf_size = kReadBufSize;
70 70
71 return true; 71 return true;
72 } 72 }
73 73
74 bool StreamResourceHandler::OnReadCompleted(int request_id, 74 bool StreamResourceHandler::OnReadCompleted(int request_id,
75 int bytes_read, 75 int bytes_read,
76 bool* defer) { 76 bool* defer) {
77 if (!bytes_read) 77 if (!bytes_read)
78 return true; 78 return true;
79 79
80 // We have more data to read. 80 // We have more data to read.
81 DCHECK(read_buffer_); 81 DCHECK(read_buffer_.get());
82 82
83 // Release the ownership of the buffer, and store a reference 83 // Release the ownership of the buffer, and store a reference
84 // to it. A new one will be allocated in OnWillRead(). 84 // to it. A new one will be allocated in OnWillRead().
85 net::IOBuffer* buffer = NULL; 85 net::IOBuffer* buffer = NULL;
86 read_buffer_.swap(&buffer); 86 read_buffer_.swap(&buffer);
87 stream_->AddData(buffer, bytes_read); 87 stream_->AddData(buffer, bytes_read);
88 88
89 if (!stream_->can_add_data()) 89 if (!stream_->can_add_data())
90 *defer = true; 90 *defer = true;
91 91
(...skipping 17 matching lines...) Expand all
109 void StreamResourceHandler::OnSpaceAvailable(Stream* stream) { 109 void StreamResourceHandler::OnSpaceAvailable(Stream* stream) {
110 controller()->Resume(); 110 controller()->Resume();
111 } 111 }
112 112
113 void StreamResourceHandler::OnClose(Stream* stream) { 113 void StreamResourceHandler::OnClose(Stream* stream) {
114 controller()->Cancel(); 114 controller()->Cancel();
115 } 115 }
116 116
117 } // namespace content 117 } // namespace content
118 118
OLDNEW
« no previous file with comments | « content/browser/loader/stream_resource_handler.h ('k') | content/browser/loader/sync_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698