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

Side by Side Diff: chrome/common/net/url_request_intercept_job.cc

Issue 18390: Change URLRequest to use a ref-counted buffer for actual IO.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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
« no previous file with comments | « chrome/common/net/url_request_intercept_job.h ('k') | net/base/bzip2_filter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // This job type handles Chrome plugin network interception. When a plugin 5 // This job type handles Chrome plugin network interception. When a plugin
6 // wants to intercept a request, a job of this type is created. The intercept 6 // wants to intercept a request, a job of this type is created. The intercept
7 // job communicates with the plugin to retrieve the response headers and data. 7 // job communicates with the plugin to retrieve the response headers and data.
8 8
9 #include "chrome/common/net/url_request_intercept_job.h" 9 #include "chrome/common/net/url_request_intercept_job.h"
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 void URLRequestInterceptJob::Kill() { 60 void URLRequestInterceptJob::Kill() {
61 if (plugin_) { 61 if (plugin_) {
62 plugin_->functions().request_funcs->end_request(cprequest_.get(), 62 plugin_->functions().request_funcs->end_request(cprequest_.get(),
63 CPERR_CANCELLED); 63 CPERR_CANCELLED);
64 DetachPlugin(); 64 DetachPlugin();
65 } 65 }
66 URLRequestJob::Kill(); 66 URLRequestJob::Kill();
67 } 67 }
68 68
69 bool URLRequestInterceptJob::ReadRawData(char* dest, int dest_size, 69 bool URLRequestInterceptJob::ReadRawData(net::IOBuffer* dest, int dest_size,
70 int* bytes_read) { 70 int* bytes_read) {
71 DCHECK_NE(dest_size, 0); 71 DCHECK_NE(dest_size, 0);
72 DCHECK(bytes_read); 72 DCHECK(bytes_read);
73 73
74 if (!plugin_) 74 if (!plugin_)
75 return false; 75 return false;
76 76
77 int rv = plugin_->functions().request_funcs->read(cprequest_.get(), 77 int rv = plugin_->functions().request_funcs->read(cprequest_.get(),
78 dest, dest_size); 78 dest->data(), dest_size);
79 if (rv >= 0) { 79 if (rv >= 0) {
80 *bytes_read = rv; 80 *bytes_read = rv;
81 return true; 81 return true;
82 } 82 }
83 83
84 if (rv == CPERR_IO_PENDING) { 84 if (rv == CPERR_IO_PENDING) {
85 read_buffer_ = dest; 85 read_buffer_ = dest;
86 read_buffer_size_ = dest_size; 86 read_buffer_size_ = dest_size;
87 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); 87 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
88 } else { 88 } else {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 203 }
204 204
205 void URLRequestInterceptJob::Observe(NotificationType type, 205 void URLRequestInterceptJob::Observe(NotificationType type,
206 const NotificationSource& source, 206 const NotificationSource& source,
207 const NotificationDetails& details) { 207 const NotificationDetails& details) {
208 DCHECK(type == NOTIFY_CHROME_PLUGIN_UNLOADED); 208 DCHECK(type == NOTIFY_CHROME_PLUGIN_UNLOADED);
209 DCHECK(plugin_ == Source<ChromePluginLib>(source).ptr()); 209 DCHECK(plugin_ == Source<ChromePluginLib>(source).ptr());
210 210
211 DetachPlugin(); 211 DetachPlugin();
212 } 212 }
OLDNEW
« no previous file with comments | « chrome/common/net/url_request_intercept_job.h ('k') | net/base/bzip2_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698