Commit fa5f474c authored by mef@chromium.org's avatar mef@chromium.org

Rename url_request_[context_]peer.* into url_request_[context_]adapter.*

BUG=390267

Review URL: https://codereview.chromium.org/453053002

Cr-Commit-Position: refs/heads/master@{#288441}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288441 0039d316-1c4b-4281-b951-d872f2087c98
parent 8cf6f849
...@@ -118,10 +118,10 @@ ...@@ -118,10 +118,10 @@
'cronet/android/org_chromium_net_UrlRequestContext.cc', 'cronet/android/org_chromium_net_UrlRequestContext.cc',
'cronet/android/org_chromium_net_UrlRequestContext.h', 'cronet/android/org_chromium_net_UrlRequestContext.h',
'cronet/android/org_chromium_net_UrlRequestContext_config_list.h', 'cronet/android/org_chromium_net_UrlRequestContext_config_list.h',
'cronet/android/url_request_context_peer.cc', 'cronet/android/url_request_adapter.cc',
'cronet/android/url_request_context_peer.h', 'cronet/android/url_request_adapter.h',
'cronet/android/url_request_peer.cc', 'cronet/android/url_request_context_adapter.cc',
'cronet/android/url_request_peer.h', 'cronet/android/url_request_context_adapter.h',
'cronet/android/wrapped_channel_upload_element_reader.cc', 'cronet/android/wrapped_channel_upload_element_reader.cc',
'cronet/android/wrapped_channel_upload_element_reader.h', 'cronet/android/wrapped_channel_upload_element_reader.h',
], ],
......
...@@ -52,9 +52,9 @@ public class UrlRequest { ...@@ -52,9 +52,9 @@ public class UrlRequest {
private final ContextLock mLock; private final ContextLock mLock;
/** /**
* Native peer object, owned by UrlRequest. * Native adapter object, owned by UrlRequest.
*/ */
private long mUrlRequestPeer; private long mUrlRequestAdapter;
/** /**
* Constructor. * Constructor.
...@@ -81,8 +81,8 @@ public class UrlRequest { ...@@ -81,8 +81,8 @@ public class UrlRequest {
mHeaders = headers; mHeaders = headers;
mSink = sink; mSink = sink;
mLock = new ContextLock(); mLock = new ContextLock();
mUrlRequestPeer = nativeCreateRequestPeer( mUrlRequestAdapter = nativeCreateRequestAdapter(
mRequestContext.getUrlRequestContextPeer(), mUrl, mPriority); mRequestContext.getUrlRequestContextAdapter(), mUrl, mPriority);
} }
/** /**
...@@ -136,7 +136,7 @@ public class UrlRequest { ...@@ -136,7 +136,7 @@ public class UrlRequest {
public void setHttpMethod(String method) { public void setHttpMethod(String method) {
validateNotStarted(); validateNotStarted();
if (!("PUT".equals(method) || "POST".equals(method))) { if (!("PUT".equals(method) || "POST".equals(method))) {
throw new IllegalArgumentException("Only PUT and POST are allowed."); throw new IllegalArgumentException("Only PUT or POST are allowed.");
} }
mMethod = method; mMethod = method;
} }
...@@ -166,12 +166,12 @@ public class UrlRequest { ...@@ -166,12 +166,12 @@ public class UrlRequest {
} }
if (method != null) { if (method != null) {
nativeSetMethod(mUrlRequestPeer, method); nativeSetMethod(mUrlRequestAdapter, method);
} }
if (mHeaders != null && !mHeaders.isEmpty()) { if (mHeaders != null && !mHeaders.isEmpty()) {
for (Entry<String, String> entry : mHeaders.entrySet()) { for (Entry<String, String> entry : mHeaders.entrySet()) {
nativeAddHeader(mUrlRequestPeer, entry.getKey(), nativeAddHeader(mUrlRequestAdapter, entry.getKey(),
entry.getValue()); entry.getValue());
} }
} }
...@@ -179,20 +179,20 @@ public class UrlRequest { ...@@ -179,20 +179,20 @@ public class UrlRequest {
if (mAdditionalHeaders != null) { if (mAdditionalHeaders != null) {
for (Entry<String, String> entry : for (Entry<String, String> entry :
mAdditionalHeaders.entrySet()) { mAdditionalHeaders.entrySet()) {
nativeAddHeader(mUrlRequestPeer, entry.getKey(), nativeAddHeader(mUrlRequestAdapter, entry.getKey(),
entry.getValue()); entry.getValue());
} }
} }
if (mUploadData != null && mUploadData.length > 0) { if (mUploadData != null && mUploadData.length > 0) {
nativeSetUploadData(mUrlRequestPeer, mUploadContentType, nativeSetUploadData(mUrlRequestAdapter, mUploadContentType,
mUploadData); mUploadData);
} else if (mUploadChannel != null) { } else if (mUploadChannel != null) {
nativeSetUploadChannel(mUrlRequestPeer, mUploadContentType, nativeSetUploadChannel(mUrlRequestAdapter, mUploadContentType,
mUploadContentLength); mUploadContentLength);
} }
nativeStart(mUrlRequestPeer); nativeStart(mUrlRequestAdapter);
} }
} }
...@@ -205,7 +205,7 @@ public class UrlRequest { ...@@ -205,7 +205,7 @@ public class UrlRequest {
mCanceled = true; mCanceled = true;
if (!mRecycled) { if (!mRecycled) {
nativeCancel(mUrlRequestPeer); nativeCancel(mUrlRequestAdapter);
} }
} }
} }
...@@ -233,12 +233,13 @@ public class UrlRequest { ...@@ -233,12 +233,13 @@ public class UrlRequest {
validateNotRecycled(); validateNotRecycled();
int errorCode = nativeGetErrorCode(mUrlRequestPeer); int errorCode = nativeGetErrorCode(mUrlRequestAdapter);
switch (errorCode) { switch (errorCode) {
case UrlRequestError.SUCCESS: case UrlRequestError.SUCCESS:
return null; return null;
case UrlRequestError.UNKNOWN: case UrlRequestError.UNKNOWN:
return new IOException(nativeGetErrorString(mUrlRequestPeer)); return new IOException(
nativeGetErrorString(mUrlRequestAdapter));
case UrlRequestError.MALFORMED_URL: case UrlRequestError.MALFORMED_URL:
return new MalformedURLException("Malformed URL: " + mUrl); return new MalformedURLException("Malformed URL: " + mUrl);
case UrlRequestError.CONNECTION_TIMED_OUT: case UrlRequestError.CONNECTION_TIMED_OUT:
...@@ -258,7 +259,7 @@ public class UrlRequest { ...@@ -258,7 +259,7 @@ public class UrlRequest {
} }
public int getHttpStatusCode() { public int getHttpStatusCode() {
return nativeGetHttpStatusCode(mUrlRequestPeer); return nativeGetHttpStatusCode(mUrlRequestAdapter);
} }
/** /**
...@@ -275,14 +276,14 @@ public class UrlRequest { ...@@ -275,14 +276,14 @@ public class UrlRequest {
public String getHeader(String name) { public String getHeader(String name) {
validateHeadersAvailable(); validateHeadersAvailable();
return nativeGetHeader(mUrlRequestPeer, name); return nativeGetHeader(mUrlRequestAdapter, name);
} }
// All response headers. // All response headers.
public Map<String, List<String>> getAllHeaders() { public Map<String, List<String>> getAllHeaders() {
validateHeadersAvailable(); validateHeadersAvailable();
ResponseHeadersMap result = new ResponseHeadersMap(); ResponseHeadersMap result = new ResponseHeadersMap();
nativeGetAllHeaders(mUrlRequestPeer, result); nativeGetAllHeaders(mUrlRequestAdapter, result);
return result; return result;
} }
...@@ -291,8 +292,8 @@ public class UrlRequest { ...@@ -291,8 +292,8 @@ public class UrlRequest {
*/ */
@CalledByNative @CalledByNative
protected void onResponseStarted() { protected void onResponseStarted() {
mContentType = nativeGetContentType(mUrlRequestPeer); mContentType = nativeGetContentType(mUrlRequestAdapter);
mContentLength = nativeGetContentLength(mUrlRequestPeer); mContentLength = nativeGetContentLength(mUrlRequestAdapter);
mHeadersAvailable = true; mHeadersAvailable = true;
} }
...@@ -339,8 +340,8 @@ public class UrlRequest { ...@@ -339,8 +340,8 @@ public class UrlRequest {
// Ignore // Ignore
} }
onRequestComplete(); onRequestComplete();
nativeDestroyRequestPeer(mUrlRequestPeer); nativeDestroyRequestAdapter(mUrlRequestAdapter);
mUrlRequestPeer = 0; mUrlRequestAdapter = 0;
mRecycled = true; mRecycled = true;
} }
} }
...@@ -410,39 +411,39 @@ public class UrlRequest { ...@@ -410,39 +411,39 @@ public class UrlRequest {
return mUrl; return mUrl;
} }
private native long nativeCreateRequestPeer(long urlRequestContextPeer, private native long nativeCreateRequestAdapter(
String url, int priority); long urlRequestContextAdapter, String url, int priority);
private native void nativeAddHeader(long urlRequestPeer, String name, private native void nativeAddHeader(long urlRequestAdapter, String name,
String value); String value);
private native void nativeSetMethod(long urlRequestPeer, String method); private native void nativeSetMethod(long urlRequestAdapter, String method);
private native void nativeSetUploadData(long urlRequestPeer, private native void nativeSetUploadData(long urlRequestAdapter,
String contentType, byte[] content); String contentType, byte[] content);
private native void nativeSetUploadChannel(long urlRequestPeer, private native void nativeSetUploadChannel(long urlRequestAdapter,
String contentType, long contentLength); String contentType, long contentLength);
private native void nativeStart(long urlRequestPeer); private native void nativeStart(long urlRequestAdapter);
private native void nativeCancel(long urlRequestPeer); private native void nativeCancel(long urlRequestAdapter);
private native void nativeDestroyRequestPeer(long urlRequestPeer); private native void nativeDestroyRequestAdapter(long urlRequestAdapter);
private native int nativeGetErrorCode(long urlRequestPeer); private native int nativeGetErrorCode(long urlRequestAdapter);
private native int nativeGetHttpStatusCode(long urlRequestPeer); private native int nativeGetHttpStatusCode(long urlRequestAdapter);
private native String nativeGetErrorString(long urlRequestPeer); private native String nativeGetErrorString(long urlRequestAdapter);
private native String nativeGetContentType(long urlRequestPeer); private native String nativeGetContentType(long urlRequestAdapter);
private native long nativeGetContentLength(long urlRequestPeer); private native long nativeGetContentLength(long urlRequestAdapter);
private native String nativeGetHeader(long urlRequestPeer, String name); private native String nativeGetHeader(long urlRequestAdapter, String name);
private native void nativeGetAllHeaders(long urlRequestPeer, private native void nativeGetAllHeaders(long urlRequestAdapter,
ResponseHeadersMap headers); ResponseHeadersMap headers);
// Explicit class to work around JNI-generator generics confusion. // Explicit class to work around JNI-generator generics confusion.
......
...@@ -23,9 +23,9 @@ public class UrlRequestContext { ...@@ -23,9 +23,9 @@ public class UrlRequestContext {
private static final String LOG_TAG = "ChromiumNetwork"; private static final String LOG_TAG = "ChromiumNetwork";
/** /**
* Native peer object, owned by UrlRequestContext. * Native adapter object, owned by UrlRequestContext.
*/ */
private long mUrlRequestContextPeer; private long mUrlRequestContextAdapter;
private final ConditionVariable mStarted = new ConditionVariable(); private final ConditionVariable mStarted = new ConditionVariable();
...@@ -35,10 +35,10 @@ public class UrlRequestContext { ...@@ -35,10 +35,10 @@ public class UrlRequestContext {
*/ */
protected UrlRequestContext(Context context, String userAgent, protected UrlRequestContext(Context context, String userAgent,
String config) { String config) {
mUrlRequestContextPeer = nativeCreateRequestContextPeer(context, mUrlRequestContextAdapter = nativeCreateRequestContextAdapter(context,
userAgent, getLoggingLevel(), config); userAgent, getLoggingLevel(), config);
if (mUrlRequestContextPeer == 0) if (mUrlRequestContextAdapter == 0)
throw new NullPointerException("Context Peer creation failed"); throw new NullPointerException("Context Adapter creation failed");
// TODO(mef): Revisit the need of block here. // TODO(mef): Revisit the need of block here.
mStarted.block(2000); mStarted.block(2000);
...@@ -75,7 +75,7 @@ public class UrlRequestContext { ...@@ -75,7 +75,7 @@ public class UrlRequestContext {
* If actively logging the call is ignored. * If actively logging the call is ignored.
*/ */
public void startNetLogToFile(String fileName) { public void startNetLogToFile(String fileName) {
nativeStartNetLogToFile(mUrlRequestContextPeer, fileName); nativeStartNetLogToFile(mUrlRequestContextAdapter, fileName);
} }
/** /**
...@@ -83,7 +83,7 @@ public class UrlRequestContext { ...@@ -83,7 +83,7 @@ public class UrlRequestContext {
* not in progress this call is ignored. * not in progress this call is ignored.
*/ */
public void stopNetLog() { public void stopNetLog() {
nativeStopNetLog(mUrlRequestContextPeer); nativeStopNetLog(mUrlRequestContextAdapter);
} }
@CalledByNative @CalledByNative
...@@ -95,12 +95,12 @@ public class UrlRequestContext { ...@@ -95,12 +95,12 @@ public class UrlRequestContext {
@Override @Override
protected void finalize() throws Throwable { protected void finalize() throws Throwable {
nativeReleaseRequestContextPeer(mUrlRequestContextPeer); nativeReleaseRequestContextAdapter(mUrlRequestContextAdapter);
super.finalize(); super.finalize();
} }
protected long getUrlRequestContextPeer() { protected long getUrlRequestContextAdapter() {
return mUrlRequestContextPeer; return mUrlRequestContextAdapter;
} }
/** /**
...@@ -119,20 +119,20 @@ public class UrlRequestContext { ...@@ -119,20 +119,20 @@ public class UrlRequestContext {
return loggingLevel; return loggingLevel;
} }
// Returns an instance URLRequestContextPeer to be stored in // Returns an instance URLRequestContextAdapter to be stored in
// mUrlRequestContextPeer. // mUrlRequestContextAdapter.
private native long nativeCreateRequestContextPeer(Context context, private native long nativeCreateRequestContextAdapter(Context context,
String userAgent, int loggingLevel, String config); String userAgent, int loggingLevel, String config);
private native void nativeReleaseRequestContextPeer( private native void nativeReleaseRequestContextAdapter(
long urlRequestContextPeer); long urlRequestContextAdapter);
private native void nativeInitializeStatistics(); private native void nativeInitializeStatistics();
private native String nativeGetStatisticsJSON(String filter); private native String nativeGetStatisticsJSON(String filter);
private native void nativeStartNetLogToFile(long urlRequestContextPeer, private native void nativeStartNetLogToFile(long urlRequestContextAdapter,
String fileName); String fileName);
private native void nativeStopNetLog(long urlRequestContextPeer); private native void nativeStopNetLog(long urlRequestContextAdapter);
} }
...@@ -14,23 +14,24 @@ ...@@ -14,23 +14,24 @@
#include "base/metrics/statistics_recorder.h" #include "base/metrics/statistics_recorder.h"
#include "base/values.h" #include "base/values.h"
#include "components/cronet/android/org_chromium_net_UrlRequest.h" #include "components/cronet/android/org_chromium_net_UrlRequest.h"
#include "components/cronet/android/url_request_context_peer.h" #include "components/cronet/android/url_request_adapter.h"
#include "components/cronet/android/url_request_peer.h" #include "components/cronet/android/url_request_context_adapter.h"
#include "components/cronet/url_request_context_config.h" #include "components/cronet/url_request_context_config.h"
#include "jni/UrlRequestContext_jni.h" #include "jni/UrlRequestContext_jni.h"
namespace { namespace {
// Delegate of URLRequestContextPeer that delivers callbacks to the Java layer. // Delegate of URLRequestContextAdapter that delivers callbacks to the Java
class JniURLRequestContextPeerDelegate // layer.
: public cronet::URLRequestContextPeer::URLRequestContextPeerDelegate { class JniURLRequestContextAdapterDelegate
: public cronet::URLRequestContextAdapter::
URLRequestContextAdapterDelegate {
public: public:
JniURLRequestContextPeerDelegate(JNIEnv* env, jobject owner) JniURLRequestContextAdapterDelegate(JNIEnv* env, jobject owner)
: owner_(env->NewGlobalRef(owner)) { : owner_(env->NewGlobalRef(owner)) {}
}
virtual void OnContextInitialized( virtual void OnContextInitialized(
cronet::URLRequestContextPeer* context) OVERRIDE { cronet::URLRequestContextAdapter* context) OVERRIDE {
JNIEnv* env = base::android::AttachCurrentThread(); JNIEnv* env = base::android::AttachCurrentThread();
cronet::Java_UrlRequestContext_initNetworkThread(env, owner_); cronet::Java_UrlRequestContext_initNetworkThread(env, owner_);
// TODO(dplotnikov): figure out if we need to detach from the thread. // TODO(dplotnikov): figure out if we need to detach from the thread.
...@@ -38,7 +39,7 @@ class JniURLRequestContextPeerDelegate ...@@ -38,7 +39,7 @@ class JniURLRequestContextPeerDelegate
} }
protected: protected:
virtual ~JniURLRequestContextPeerDelegate() { virtual ~JniURLRequestContextAdapterDelegate() {
JNIEnv* env = base::android::AttachCurrentThread(); JNIEnv* env = base::android::AttachCurrentThread();
env->DeleteGlobalRef(owner_); env->DeleteGlobalRef(owner_);
} }
...@@ -57,7 +58,7 @@ bool UrlRequestContextRegisterJni(JNIEnv* env) { ...@@ -57,7 +58,7 @@ bool UrlRequestContextRegisterJni(JNIEnv* env) {
} }
// Sets global user-agent to be used for all subsequent requests. // Sets global user-agent to be used for all subsequent requests.
static jlong CreateRequestContextPeer(JNIEnv* env, static jlong CreateRequestContextAdapter(JNIEnv* env,
jobject object, jobject object,
jobject context, jobject context,
jstring user_agent, jstring user_agent,
...@@ -92,24 +93,25 @@ static jlong CreateRequestContextPeer(JNIEnv* env, ...@@ -92,24 +93,25 @@ static jlong CreateRequestContextPeer(JNIEnv* env,
logging::SetMinLogLevel(static_cast<int>(log_level)); logging::SetMinLogLevel(static_cast<int>(log_level));
// TODO(dplotnikov): set application context. // TODO(dplotnikov): set application context.
URLRequestContextPeer* peer = new URLRequestContextPeer( URLRequestContextAdapter* adapter = new URLRequestContextAdapter(
new JniURLRequestContextPeerDelegate(env, object), user_agent_string); new JniURLRequestContextAdapterDelegate(env, object), user_agent_string);
peer->AddRef(); // Hold onto this ref-counted object. adapter->AddRef(); // Hold onto this ref-counted object.
peer->Initialize(context_config.Pass()); adapter->Initialize(context_config.Pass());
return reinterpret_cast<jlong>(peer); return reinterpret_cast<jlong>(adapter);
} }
// Releases native objects. // Releases native objects.
static void ReleaseRequestContextPeer(JNIEnv* env, static void ReleaseRequestContextAdapter(JNIEnv* env,
jobject object, jobject object,
jlong urlRequestContextPeer) { jlong urlRequestContextAdapter) {
URLRequestContextPeer* peer = URLRequestContextAdapter* adapter =
reinterpret_cast<URLRequestContextPeer*>(urlRequestContextPeer); reinterpret_cast<URLRequestContextAdapter*>(urlRequestContextAdapter);
// TODO(mef): Revisit this from thread safety point of view: Can we delete a // TODO(mef): Revisit this from thread safety point of view: Can we delete a
// thread while running on that thread? // thread while running on that thread?
// URLRequestContextPeer is a ref-counted object, and may have pending tasks, // URLRequestContextAdapter is a ref-counted object, and may have pending
// tasks,
// so we need to release it instead of deleting here. // so we need to release it instead of deleting here.
peer->Release(); adapter->Release();
} }
// Starts recording statistics. // Starts recording statistics.
...@@ -128,21 +130,21 @@ static jstring GetStatisticsJSON(JNIEnv* env, jobject jcaller, jstring filter) { ...@@ -128,21 +130,21 @@ static jstring GetStatisticsJSON(JNIEnv* env, jobject jcaller, jstring filter) {
// Starts recording NetLog into file with |fileName|. // Starts recording NetLog into file with |fileName|.
static void StartNetLogToFile(JNIEnv* env, static void StartNetLogToFile(JNIEnv* env,
jobject jcaller, jobject jcaller,
jlong urlRequestContextPeer, jlong urlRequestContextAdapter,
jstring fileName) { jstring fileName) {
URLRequestContextPeer* peer = URLRequestContextAdapter* adapter =
reinterpret_cast<URLRequestContextPeer*>(urlRequestContextPeer); reinterpret_cast<URLRequestContextAdapter*>(urlRequestContextAdapter);
std::string file_name = base::android::ConvertJavaStringToUTF8(env, fileName); std::string file_name = base::android::ConvertJavaStringToUTF8(env, fileName);
peer->StartNetLogToFile(file_name); adapter->StartNetLogToFile(file_name);
} }
// Stops recording NetLog. // Stops recording NetLog.
static void StopNetLog(JNIEnv* env, static void StopNetLog(JNIEnv* env,
jobject jcaller, jobject jcaller,
jlong urlRequestContextPeer) { jlong urlRequestContextAdapter) {
URLRequestContextPeer* peer = URLRequestContextAdapter* adapter =
reinterpret_cast<URLRequestContextPeer*>(urlRequestContextPeer); reinterpret_cast<URLRequestContextAdapter*>(urlRequestContextAdapter);
peer->StopNetLog(); adapter->StopNetLog();
} }
} // namespace cronet } // namespace cronet
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "url_request_peer.h" #include "url_request_adapter.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "components/cronet/android/url_request_context_peer.h" #include "components/cronet/android/url_request_context_adapter.h"
#include "components/cronet/android/wrapped_channel_upload_element_reader.h" #include "components/cronet/android/wrapped_channel_upload_element_reader.h"
#include "net/base/load_flags.h" #include "net/base/load_flags.h"
#include "net/base/upload_bytes_element_reader.h" #include "net/base/upload_bytes_element_reader.h"
...@@ -15,8 +15,8 @@ namespace cronet { ...@@ -15,8 +15,8 @@ namespace cronet {
static const size_t kBufferSizeIncrement = 8192; static const size_t kBufferSizeIncrement = 8192;
URLRequestPeer::URLRequestPeer(URLRequestContextPeer* context, URLRequestAdapter::URLRequestAdapter(URLRequestContextAdapter* context,
URLRequestPeerDelegate* delegate, URLRequestAdapterDelegate* delegate,
GURL url, GURL url,
net::RequestPriority priority) net::RequestPriority priority)
: method_("GET"), : method_("GET"),
...@@ -34,31 +34,35 @@ URLRequestPeer::URLRequestPeer(URLRequestContextPeer* context, ...@@ -34,31 +34,35 @@ URLRequestPeer::URLRequestPeer(URLRequestContextPeer* context,
priority_ = priority; priority_ = priority;
} }
URLRequestPeer::~URLRequestPeer() { CHECK(url_request_ == NULL); } URLRequestAdapter::~URLRequestAdapter() {
CHECK(url_request_ == NULL);
}
void URLRequestPeer::SetMethod(const std::string& method) { method_ = method; } void URLRequestAdapter::SetMethod(const std::string& method) {
method_ = method;
}
void URLRequestPeer::AddHeader(const std::string& name, void URLRequestAdapter::AddHeader(const std::string& name,
const std::string& value) { const std::string& value) {
headers_.SetHeader(name, value); headers_.SetHeader(name, value);
} }
void URLRequestPeer::SetUploadContent(const char* bytes, int bytes_len) { void URLRequestAdapter::SetUploadContent(const char* bytes, int bytes_len) {
std::vector<char> data(bytes, bytes + bytes_len); std::vector<char> data(bytes, bytes + bytes_len);
scoped_ptr<net::UploadElementReader> reader( scoped_ptr<net::UploadElementReader> reader(
new net::UploadOwnedBytesElementReader(&data)); new net::UploadOwnedBytesElementReader(&data));
upload_data_stream_.reset(net::UploadDataStream::CreateWithReader( upload_data_stream_.reset(
reader.Pass(), 0)); net::UploadDataStream::CreateWithReader(reader.Pass(), 0));
} }
void URLRequestPeer::SetUploadChannel(JNIEnv* env, int64 content_length) { void URLRequestAdapter::SetUploadChannel(JNIEnv* env, int64 content_length) {
scoped_ptr<net::UploadElementReader> reader( scoped_ptr<net::UploadElementReader> reader(
new WrappedChannelElementReader(delegate_, content_length)); new WrappedChannelElementReader(delegate_, content_length));
upload_data_stream_.reset(net::UploadDataStream::CreateWithReader( upload_data_stream_.reset(
reader.Pass(), 0)); net::UploadDataStream::CreateWithReader(reader.Pass(), 0));
} }
std::string URLRequestPeer::GetHeader(const std::string &name) const { std::string URLRequestAdapter::GetHeader(const std::string& name) const {
std::string value; std::string value;
if (url_request_ != NULL) { if (url_request_ != NULL) {
url_request_->GetResponseHeaderByName(name, &value); url_request_->GetResponseHeaderByName(name, &value);
...@@ -66,21 +70,21 @@ std::string URLRequestPeer::GetHeader(const std::string &name) const { ...@@ -66,21 +70,21 @@ std::string URLRequestPeer::GetHeader(const std::string &name) const {
return value; return value;
} }
net::HttpResponseHeaders* URLRequestPeer::GetResponseHeaders() const { net::HttpResponseHeaders* URLRequestAdapter::GetResponseHeaders() const {
if (url_request_ == NULL) { if (url_request_ == NULL) {
return NULL; return NULL;
} }
return url_request_->response_headers(); return url_request_->response_headers();
} }
void URLRequestPeer::Start() { void URLRequestAdapter::Start() {
context_->GetNetworkTaskRunner()->PostTask( context_->GetNetworkTaskRunner()->PostTask(
FROM_HERE, FROM_HERE,
base::Bind(&URLRequestPeer::OnInitiateConnection, base::Bind(&URLRequestAdapter::OnInitiateConnection,
base::Unretained(this))); base::Unretained(this)));
} }
void URLRequestPeer::OnInitiateConnection() { void URLRequestAdapter::OnInitiateConnection() {
if (canceled_) { if (canceled_) {
return; return;
} }
...@@ -110,7 +114,7 @@ void URLRequestPeer::OnInitiateConnection() { ...@@ -110,7 +114,7 @@ void URLRequestPeer::OnInitiateConnection() {
url_request_->Start(); url_request_->Start();
} }
void URLRequestPeer::Cancel() { void URLRequestAdapter::Cancel() {
if (canceled_) { if (canceled_) {
return; return;
} }
...@@ -119,10 +123,10 @@ void URLRequestPeer::Cancel() { ...@@ -119,10 +123,10 @@ void URLRequestPeer::Cancel() {
context_->GetNetworkTaskRunner()->PostTask( context_->GetNetworkTaskRunner()->PostTask(
FROM_HERE, FROM_HERE,
base::Bind(&URLRequestPeer::OnCancelRequest, base::Unretained(this))); base::Bind(&URLRequestAdapter::OnCancelRequest, base::Unretained(this)));
} }
void URLRequestPeer::OnCancelRequest() { void URLRequestAdapter::OnCancelRequest() {
VLOG(1) << "Canceling chromium request: " << url_.possibly_invalid_spec(); VLOG(1) << "Canceling chromium request: " << url_.possibly_invalid_spec();
if (url_request_ != NULL) { if (url_request_ != NULL) {
...@@ -132,19 +136,19 @@ void URLRequestPeer::OnCancelRequest() { ...@@ -132,19 +136,19 @@ void URLRequestPeer::OnCancelRequest() {
OnRequestCanceled(); OnRequestCanceled();
} }
void URLRequestPeer::Destroy() { void URLRequestAdapter::Destroy() {
context_->GetNetworkTaskRunner()->PostTask( context_->GetNetworkTaskRunner()->PostTask(
FROM_HERE, base::Bind(&URLRequestPeer::OnDestroyRequest, this)); FROM_HERE, base::Bind(&URLRequestAdapter::OnDestroyRequest, this));
} }
// static // static
void URLRequestPeer::OnDestroyRequest(URLRequestPeer* self) { void URLRequestAdapter::OnDestroyRequest(URLRequestAdapter* self) {
VLOG(1) << "Destroying chromium request: " VLOG(1) << "Destroying chromium request: "
<< self->url_.possibly_invalid_spec(); << self->url_.possibly_invalid_spec();
delete self; delete self;
} }
void URLRequestPeer::OnResponseStarted(net::URLRequest* request) { void URLRequestAdapter::OnResponseStarted(net::URLRequest* request) {
if (request->status().status() != net::URLRequestStatus::SUCCESS) { if (request->status().status() != net::URLRequestStatus::SUCCESS) {
OnRequestFailed(); OnRequestFailed();
return; return;
...@@ -161,7 +165,7 @@ void URLRequestPeer::OnResponseStarted(net::URLRequest* request) { ...@@ -161,7 +165,7 @@ void URLRequestPeer::OnResponseStarted(net::URLRequest* request) {
} }
// Reads all available data or starts an asynchronous read. // Reads all available data or starts an asynchronous read.
void URLRequestPeer::Read() { void URLRequestAdapter::Read() {
while (true) { while (true) {
if (read_buffer_->RemainingCapacity() == 0) { if (read_buffer_->RemainingCapacity() == 0) {
int new_capacity = read_buffer_->capacity() + kBufferSizeIncrement; int new_capacity = read_buffer_->capacity() + kBufferSizeIncrement;
...@@ -196,7 +200,8 @@ void URLRequestPeer::Read() { ...@@ -196,7 +200,8 @@ void URLRequestPeer::Read() {
} }
} }
void URLRequestPeer::OnReadCompleted(net::URLRequest* request, int bytes_read) { void URLRequestAdapter::OnReadCompleted(net::URLRequest* request,
int bytes_read) {
VLOG(1) << "Asynchronously read: " << bytes_read << " bytes"; VLOG(1) << "Asynchronously read: " << bytes_read << " bytes";
if (bytes_read < 0) { if (bytes_read < 0) {
OnRequestFailed(); OnRequestFailed();
...@@ -210,13 +215,13 @@ void URLRequestPeer::OnReadCompleted(net::URLRequest* request, int bytes_read) { ...@@ -210,13 +215,13 @@ void URLRequestPeer::OnReadCompleted(net::URLRequest* request, int bytes_read) {
Read(); Read();
} }
void URLRequestPeer::OnBytesRead(int bytes_read) { void URLRequestAdapter::OnBytesRead(int bytes_read) {
read_buffer_->set_offset(read_buffer_->offset() + bytes_read); read_buffer_->set_offset(read_buffer_->offset() + bytes_read);
bytes_read_ += bytes_read; bytes_read_ += bytes_read;
total_bytes_read_ += bytes_read; total_bytes_read_ += bytes_read;
} }
void URLRequestPeer::OnRequestSucceeded() { void URLRequestAdapter::OnRequestSucceeded() {
if (canceled_) { if (canceled_) {
return; return;
} }
...@@ -227,7 +232,7 @@ void URLRequestPeer::OnRequestSucceeded() { ...@@ -227,7 +232,7 @@ void URLRequestPeer::OnRequestSucceeded() {
OnRequestCompleted(); OnRequestCompleted();
} }
void URLRequestPeer::OnRequestFailed() { void URLRequestAdapter::OnRequestFailed() {
if (canceled_) { if (canceled_) {
return; return;
} }
...@@ -238,9 +243,11 @@ void URLRequestPeer::OnRequestFailed() { ...@@ -238,9 +243,11 @@ void URLRequestPeer::OnRequestFailed() {
OnRequestCompleted(); OnRequestCompleted();
} }
void URLRequestPeer::OnRequestCanceled() { OnRequestCompleted(); } void URLRequestAdapter::OnRequestCanceled() {
OnRequestCompleted();
}
void URLRequestPeer::OnRequestCompleted() { void URLRequestAdapter::OnRequestCompleted() {
VLOG(1) << "Completed: " << url_.possibly_invalid_spec(); VLOG(1) << "Completed: " << url_.possibly_invalid_spec();
if (url_request_ != NULL) { if (url_request_ != NULL) {
delete url_request_; delete url_request_;
...@@ -251,7 +258,7 @@ void URLRequestPeer::OnRequestCompleted() { ...@@ -251,7 +258,7 @@ void URLRequestPeer::OnRequestCompleted() {
delegate_->OnRequestFinished(this); delegate_->OnRequestFinished(this);
} }
unsigned char* URLRequestPeer::Data() const { unsigned char* URLRequestAdapter::Data() const {
return reinterpret_cast<unsigned char*>(read_buffer_->StartOfBuffer()); return reinterpret_cast<unsigned char*>(read_buffer_->StartOfBuffer());
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef COMPONENTS_CRONET_ANDROID_URL_REQUEST_PEER_H_ #ifndef COMPONENTS_CRONET_ANDROID_URL_REQUEST_ADAPTER_H_
#define COMPONENTS_CRONET_ANDROID_URL_REQUEST_PEER_H_ #define COMPONENTS_CRONET_ANDROID_URL_REQUEST_ADAPTER_H_
#include <jni.h> #include <jni.h>
...@@ -24,31 +24,31 @@ class UploadDataStream; ...@@ -24,31 +24,31 @@ class UploadDataStream;
namespace cronet { namespace cronet {
class URLRequestContextPeer; class URLRequestContextAdapter;
// An adapter from the JNI |UrlRequest| object and the Chromium |URLRequest| // An adapter from the JNI |UrlRequest| object and the Chromium |URLRequest|
// object. // object.
class URLRequestPeer : public net::URLRequest::Delegate { class URLRequestAdapter : public net::URLRequest::Delegate {
public: public:
// The delegate which is called when the request finishes. // The delegate which is called when the request finishes.
class URLRequestPeerDelegate class URLRequestAdapterDelegate
: public base::RefCountedThreadSafe<URLRequestPeerDelegate> { : public base::RefCountedThreadSafe<URLRequestAdapterDelegate> {
public: public:
virtual void OnResponseStarted(URLRequestPeer* request) = 0; virtual void OnResponseStarted(URLRequestAdapter* request) = 0;
virtual void OnBytesRead(URLRequestPeer* request) = 0; virtual void OnBytesRead(URLRequestAdapter* request) = 0;
virtual void OnRequestFinished(URLRequestPeer* request) = 0; virtual void OnRequestFinished(URLRequestAdapter* request) = 0;
virtual int ReadFromUploadChannel(net::IOBuffer* buf, int buf_length) = 0; virtual int ReadFromUploadChannel(net::IOBuffer* buf, int buf_length) = 0;
protected: protected:
friend class base::RefCountedThreadSafe<URLRequestPeerDelegate>; friend class base::RefCountedThreadSafe<URLRequestAdapterDelegate>;
virtual ~URLRequestPeerDelegate() {} virtual ~URLRequestAdapterDelegate() {}
}; };
URLRequestPeer(URLRequestContextPeer* context, URLRequestAdapter(URLRequestContextAdapter* context,
URLRequestPeerDelegate* delegate, URLRequestAdapterDelegate* delegate,
GURL url, GURL url,
net::RequestPriority priority); net::RequestPriority priority);
virtual ~URLRequestPeer(); virtual ~URLRequestAdapter();
// Sets the request method GET, POST etc // Sets the request method GET, POST etc
void SetMethod(const std::string& method); void SetMethod(const std::string& method);
...@@ -107,7 +107,7 @@ class URLRequestPeer : public net::URLRequest::Delegate { ...@@ -107,7 +107,7 @@ class URLRequestPeer : public net::URLRequest::Delegate {
int bytes_read) OVERRIDE; int bytes_read) OVERRIDE;
private: private:
static void OnDestroyRequest(URLRequestPeer* self); static void OnDestroyRequest(URLRequestAdapter* self);
void OnInitiateConnection(); void OnInitiateConnection();
void OnCancelRequest(); void OnCancelRequest();
...@@ -120,8 +120,8 @@ class URLRequestPeer : public net::URLRequest::Delegate { ...@@ -120,8 +120,8 @@ class URLRequestPeer : public net::URLRequest::Delegate {
void Read(); void Read();
URLRequestContextPeer* context_; URLRequestContextAdapter* context_;
scoped_refptr<URLRequestPeerDelegate> delegate_; scoped_refptr<URLRequestAdapterDelegate> delegate_;
GURL url_; GURL url_;
net::RequestPriority priority_; net::RequestPriority priority_;
std::string method_; std::string method_;
...@@ -137,9 +137,9 @@ class URLRequestPeer : public net::URLRequest::Delegate { ...@@ -137,9 +137,9 @@ class URLRequestPeer : public net::URLRequest::Delegate {
bool canceled_; bool canceled_;
int64 expected_size_; int64 expected_size_;
DISALLOW_COPY_AND_ASSIGN(URLRequestPeer); DISALLOW_COPY_AND_ASSIGN(URLRequestAdapter);
}; };
} // namespace cronet } // namespace cronet
#endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_PEER_H_ #endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_ADAPTER_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "components/cronet/android/url_request_context_peer.h" #include "components/cronet/android/url_request_context_adapter.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/file_util.h" #include "base/file_util.h"
...@@ -94,8 +94,8 @@ class BasicNetworkDelegate : public net::NetworkDelegate { ...@@ -94,8 +94,8 @@ class BasicNetworkDelegate : public net::NetworkDelegate {
return false; return false;
} }
virtual bool OnCanThrottleRequest(const net::URLRequest& request) virtual bool OnCanThrottleRequest(
const OVERRIDE { const net::URLRequest& request) const OVERRIDE {
return false; return false;
} }
...@@ -112,14 +112,14 @@ class BasicNetworkDelegate : public net::NetworkDelegate { ...@@ -112,14 +112,14 @@ class BasicNetworkDelegate : public net::NetworkDelegate {
namespace cronet { namespace cronet {
URLRequestContextPeer::URLRequestContextPeer( URLRequestContextAdapter::URLRequestContextAdapter(
URLRequestContextPeerDelegate* delegate, URLRequestContextAdapterDelegate* delegate,
std::string user_agent) { std::string user_agent) {
delegate_ = delegate; delegate_ = delegate;
user_agent_ = user_agent; user_agent_ = user_agent;
} }
void URLRequestContextPeer::Initialize( void URLRequestContextAdapter::Initialize(
scoped_ptr<URLRequestContextConfig> config) { scoped_ptr<URLRequestContextConfig> config) {
network_thread_ = new base::Thread("network"); network_thread_ = new base::Thread("network");
base::Thread::Options options; base::Thread::Options options;
...@@ -128,12 +128,12 @@ void URLRequestContextPeer::Initialize( ...@@ -128,12 +128,12 @@ void URLRequestContextPeer::Initialize(
GetNetworkTaskRunner()->PostTask( GetNetworkTaskRunner()->PostTask(
FROM_HERE, FROM_HERE,
base::Bind(&URLRequestContextPeer::InitializeURLRequestContext, base::Bind(&URLRequestContextAdapter::InitializeURLRequestContext,
this, this,
Passed(&config))); Passed(&config)));
} }
void URLRequestContextPeer::InitializeURLRequestContext( void URLRequestContextAdapter::InitializeURLRequestContext(
scoped_ptr<URLRequestContextConfig> config) { scoped_ptr<URLRequestContextConfig> config) {
// TODO(mmenke): Add method to have the builder enable SPDY. // TODO(mmenke): Add method to have the builder enable SPDY.
net::URLRequestContextBuilder context_builder; net::URLRequestContextBuilder context_builder;
...@@ -153,7 +153,7 @@ void URLRequestContextPeer::InitializeURLRequestContext( ...@@ -153,7 +153,7 @@ void URLRequestContextPeer::InitializeURLRequestContext(
delegate_->OnContextInitialized(this); delegate_->OnContextInitialized(this);
} }
URLRequestContextPeer::~URLRequestContextPeer() { URLRequestContextAdapter::~URLRequestContextAdapter() {
if (net_log_observer_) { if (net_log_observer_) {
context_->net_log()->RemoveThreadSafeObserver(net_log_observer_.get()); context_->net_log()->RemoveThreadSafeObserver(net_log_observer_.get());
net_log_observer_.reset(); net_log_observer_.reset();
...@@ -162,11 +162,12 @@ URLRequestContextPeer::~URLRequestContextPeer() { ...@@ -162,11 +162,12 @@ URLRequestContextPeer::~URLRequestContextPeer() {
// TODO(mef): Ensure that |network_thread_| is destroyed properly. // TODO(mef): Ensure that |network_thread_| is destroyed properly.
} }
const std::string& URLRequestContextPeer::GetUserAgent(const GURL& url) const { const std::string& URLRequestContextAdapter::GetUserAgent(
const GURL& url) const {
return user_agent_; return user_agent_;
} }
net::URLRequestContext* URLRequestContextPeer::GetURLRequestContext() { net::URLRequestContext* URLRequestContextAdapter::GetURLRequestContext() {
if (!context_) { if (!context_) {
LOG(ERROR) << "URLRequestContext is not set up"; LOG(ERROR) << "URLRequestContext is not set up";
} }
...@@ -174,11 +175,11 @@ net::URLRequestContext* URLRequestContextPeer::GetURLRequestContext() { ...@@ -174,11 +175,11 @@ net::URLRequestContext* URLRequestContextPeer::GetURLRequestContext() {
} }
scoped_refptr<base::SingleThreadTaskRunner> scoped_refptr<base::SingleThreadTaskRunner>
URLRequestContextPeer::GetNetworkTaskRunner() const { URLRequestContextAdapter::GetNetworkTaskRunner() const {
return network_thread_->message_loop_proxy(); return network_thread_->message_loop_proxy();
} }
void URLRequestContextPeer::StartNetLogToFile(const std::string& file_name) { void URLRequestContextAdapter::StartNetLogToFile(const std::string& file_name) {
// Do nothing if already logging to a file. // Do nothing if already logging to a file.
if (net_log_logger_) if (net_log_logger_)
return; return;
...@@ -193,7 +194,7 @@ void URLRequestContextPeer::StartNetLogToFile(const std::string& file_name) { ...@@ -193,7 +194,7 @@ void URLRequestContextPeer::StartNetLogToFile(const std::string& file_name) {
net_log_logger_->StartObserving(context_->net_log()); net_log_logger_->StartObserving(context_->net_log());
} }
void URLRequestContextPeer::StopNetLog() { void URLRequestContextAdapter::StopNetLog() {
if (net_log_logger_) { if (net_log_logger_) {
net_log_logger_->StopObserving(); net_log_logger_->StopObserving();
net_log_logger_.reset(); net_log_logger_.reset();
...@@ -202,8 +203,7 @@ void URLRequestContextPeer::StopNetLog() { ...@@ -202,8 +203,7 @@ void URLRequestContextPeer::StopNetLog() {
void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) { void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) {
VLOG(2) << "Net log entry: type=" << entry.type() VLOG(2) << "Net log entry: type=" << entry.type()
<< ", source=" << entry.source().type << ", source=" << entry.source().type << ", phase=" << entry.phase();
<< ", phase=" << entry.phase();
} }
} // namespace cronet } // namespace cronet
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_PEER_H_ #ifndef COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_
#define COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_PEER_H_ #define COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_
#include <string> #include <string>
...@@ -39,20 +39,20 @@ class NetLogObserver : public net::NetLog::ThreadSafeObserver { ...@@ -39,20 +39,20 @@ class NetLogObserver : public net::NetLog::ThreadSafeObserver {
}; };
// Fully configured |URLRequestContext|. // Fully configured |URLRequestContext|.
class URLRequestContextPeer : public net::URLRequestContextGetter { class URLRequestContextAdapter : public net::URLRequestContextGetter {
public: public:
class URLRequestContextPeerDelegate class URLRequestContextAdapterDelegate
: public base::RefCountedThreadSafe<URLRequestContextPeerDelegate> { : public base::RefCountedThreadSafe<URLRequestContextAdapterDelegate> {
public: public:
virtual void OnContextInitialized(URLRequestContextPeer* context) = 0; virtual void OnContextInitialized(URLRequestContextAdapter* context) = 0;
protected: protected:
friend class base::RefCountedThreadSafe<URLRequestContextPeerDelegate>; friend class base::RefCountedThreadSafe<URLRequestContextAdapterDelegate>;
virtual ~URLRequestContextPeerDelegate() {} virtual ~URLRequestContextAdapterDelegate() {}
}; };
URLRequestContextPeer(URLRequestContextPeerDelegate* delegate, URLRequestContextAdapter(URLRequestContextAdapterDelegate* delegate,
std::string user_agent); std::string user_agent);
void Initialize(scoped_ptr<URLRequestContextConfig> config); void Initialize(scoped_ptr<URLRequestContextConfig> config);
...@@ -67,7 +67,7 @@ class URLRequestContextPeer : public net::URLRequestContextGetter { ...@@ -67,7 +67,7 @@ class URLRequestContextPeer : public net::URLRequestContextGetter {
void StopNetLog(); void StopNetLog();
private: private:
scoped_refptr<URLRequestContextPeerDelegate> delegate_; scoped_refptr<URLRequestContextAdapterDelegate> delegate_;
scoped_ptr<net::URLRequestContext> context_; scoped_ptr<net::URLRequestContext> context_;
std::string user_agent_; std::string user_agent_;
base::Thread* network_thread_; base::Thread* network_thread_;
...@@ -75,14 +75,14 @@ class URLRequestContextPeer : public net::URLRequestContextGetter { ...@@ -75,14 +75,14 @@ class URLRequestContextPeer : public net::URLRequestContextGetter {
scoped_ptr<NetLogObserver> net_log_observer_; scoped_ptr<NetLogObserver> net_log_observer_;
scoped_ptr<net::NetLogLogger> net_log_logger_; scoped_ptr<net::NetLogLogger> net_log_logger_;
virtual ~URLRequestContextPeer(); virtual ~URLRequestContextAdapter();
// Initializes |context_| on the IO thread. // Initializes |context_| on the IO thread.
void InitializeURLRequestContext(scoped_ptr<URLRequestContextConfig> config); void InitializeURLRequestContext(scoped_ptr<URLRequestContextConfig> config);
DISALLOW_COPY_AND_ASSIGN(URLRequestContextPeer); DISALLOW_COPY_AND_ASSIGN(URLRequestContextAdapter);
}; };
} // namespace cronet } // namespace cronet
#endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_PEER_H_ #endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_CONTEXT_ADAPTER_H_
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
namespace cronet { namespace cronet {
WrappedChannelElementReader::WrappedChannelElementReader( WrappedChannelElementReader::WrappedChannelElementReader(
scoped_refptr<URLRequestPeer::URLRequestPeerDelegate> delegate, scoped_refptr<URLRequestAdapter::URLRequestAdapterDelegate> delegate,
uint64 length) uint64 length)
: length_(length), offset_(0), delegate_(delegate) { : length_(length), offset_(0), delegate_(delegate) {
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "components/cronet/android/url_request_peer.h" #include "components/cronet/android/url_request_adapter.h"
#include "net/base/completion_callback.h" #include "net/base/completion_callback.h"
#include "net/base/upload_element_reader.h" #include "net/base/upload_element_reader.h"
...@@ -24,7 +24,7 @@ namespace cronet { ...@@ -24,7 +24,7 @@ namespace cronet {
class WrappedChannelElementReader : public net::UploadElementReader { class WrappedChannelElementReader : public net::UploadElementReader {
public: public:
WrappedChannelElementReader( WrappedChannelElementReader(
scoped_refptr<URLRequestPeer::URLRequestPeerDelegate> delegate, scoped_refptr<URLRequestAdapter::URLRequestAdapterDelegate> delegate,
uint64 length); uint64 length);
virtual ~WrappedChannelElementReader(); virtual ~WrappedChannelElementReader();
...@@ -40,7 +40,7 @@ class WrappedChannelElementReader : public net::UploadElementReader { ...@@ -40,7 +40,7 @@ class WrappedChannelElementReader : public net::UploadElementReader {
private: private:
const uint64 length_; const uint64 length_;
uint64 offset_; uint64 offset_;
scoped_refptr<URLRequestPeer::URLRequestPeerDelegate> delegate_; scoped_refptr<URLRequestAdapter::URLRequestAdapterDelegate> delegate_;
DISALLOW_COPY_AND_ASSIGN(WrappedChannelElementReader); DISALLOW_COPY_AND_ASSIGN(WrappedChannelElementReader);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment