summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authormmenke <mmenke@chromium.org>2015-05-14 13:43:30 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-14 20:43:44 +0000
commit3eea47aeb4d4111ad0e5f3c4f6933cc9dae151eb (patch)
tree663aa985eb100a7bdb9ba0ec48914e8fad27ec7d /components
parent83ae5dcbc03a9208423fe4208ad61bde2944601b (diff)
downloadchromium_src-3eea47aeb4d4111ad0e5f3c4f6933cc9dae151eb.zip
chromium_src-3eea47aeb4d4111ad0e5f3c4f6933cc9dae151eb.tar.gz
chromium_src-3eea47aeb4d4111ad0e5f3c4f6933cc9dae151eb.tar.bz2
Rename CronetUploadDataStreamAdapter to CronetUploadDataStream.
Will rename CronetUploadDataStreamDelegate to CronetUploadDataStreamAdapter in a followup CL. BUG=481119 Review URL: https://codereview.chromium.org/1124333003 Cr-Commit-Position: refs/heads/master@{#329926}
Diffstat (limited to 'components')
-rw-r--r--components/cronet/android/cronet_upload_data_stream.cc (renamed from components/cronet/android/cronet_upload_data_stream_adapter.cc)25
-rw-r--r--components/cronet/android/cronet_upload_data_stream.h (renamed from components/cronet/android/cronet_upload_data_stream_adapter.h)36
-rw-r--r--components/cronet/android/cronet_upload_data_stream_delegate.cc47
-rw-r--r--components/cronet/android/cronet_upload_data_stream_delegate.h22
-rw-r--r--components/cronet/android/java/src/org/chromium/net/CronetUploadDataStream.java32
-rw-r--r--components/cronet/android/test/javatests/src/org/chromium/net/CronetUploadTest.java46
-rw-r--r--components/cronet/cronet_static.gypi8
7 files changed, 106 insertions, 110 deletions
diff --git a/components/cronet/android/cronet_upload_data_stream_adapter.cc b/components/cronet/android/cronet_upload_data_stream.cc
index 4ac38b9..c933f40 100644
--- a/components/cronet/android/cronet_upload_data_stream_adapter.cc
+++ b/components/cronet/android/cronet_upload_data_stream.cc
@@ -2,15 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/cronet/android/cronet_upload_data_stream_adapter.h"
+#include "components/cronet/android/cronet_upload_data_stream.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
namespace cronet {
-CronetUploadDataStreamAdapter::CronetUploadDataStreamAdapter(Delegate* delegate,
- int64 size)
+CronetUploadDataStream::CronetUploadDataStream(Delegate* delegate, int64 size)
: UploadDataStream(size < 0, 0),
size_(size),
waiting_on_read_(false),
@@ -22,12 +21,12 @@ CronetUploadDataStreamAdapter::CronetUploadDataStreamAdapter(Delegate* delegate,
weak_factory_(this) {
}
-CronetUploadDataStreamAdapter::~CronetUploadDataStreamAdapter() {
- delegate_->OnAdapterDestroyed();
+CronetUploadDataStream::~CronetUploadDataStream() {
+ delegate_->OnUploadDataStreamDestroyed();
}
-int CronetUploadDataStreamAdapter::InitInternal() {
- // ResetInternal should have been called before init, if the adapter was in
+int CronetUploadDataStream::InitInternal() {
+ // ResetInternal should have been called before init, if the stream was in
// use.
DCHECK(!waiting_on_read_);
DCHECK(!waiting_on_rewind_);
@@ -57,8 +56,7 @@ int CronetUploadDataStreamAdapter::InitInternal() {
return net::ERR_IO_PENDING;
}
-int CronetUploadDataStreamAdapter::ReadInternal(net::IOBuffer* buf,
- int buf_len) {
+int CronetUploadDataStream::ReadInternal(net::IOBuffer* buf, int buf_len) {
// All pending operations should have completed before a read can start.
DCHECK(!waiting_on_read_);
DCHECK(!read_in_progress_);
@@ -75,15 +73,14 @@ int CronetUploadDataStreamAdapter::ReadInternal(net::IOBuffer* buf,
return net::ERR_IO_PENDING;
}
-void CronetUploadDataStreamAdapter::ResetInternal() {
+void CronetUploadDataStream::ResetInternal() {
// Consumer is not waiting on any operation. Note that the active operation,
// if any, will continue.
waiting_on_read_ = false;
waiting_on_rewind_ = false;
}
-void CronetUploadDataStreamAdapter::OnReadSuccess(int bytes_read,
- bool final_chunk) {
+void CronetUploadDataStream::OnReadSuccess(int bytes_read, bool final_chunk) {
DCHECK(read_in_progress_);
DCHECK(!rewind_in_progress_);
DCHECK(bytes_read > 0 || (final_chunk && bytes_read == 0));
@@ -109,7 +106,7 @@ void CronetUploadDataStreamAdapter::OnReadSuccess(int bytes_read,
OnReadCompleted(bytes_read);
}
-void CronetUploadDataStreamAdapter::OnRewindSuccess() {
+void CronetUploadDataStream::OnRewindSuccess() {
DCHECK(!waiting_on_read_);
DCHECK(!read_in_progress_);
DCHECK(rewind_in_progress_);
@@ -127,7 +124,7 @@ void CronetUploadDataStreamAdapter::OnRewindSuccess() {
OnInitCompleted(net::OK);
}
-void CronetUploadDataStreamAdapter::StartRewind() {
+void CronetUploadDataStream::StartRewind() {
DCHECK(!waiting_on_read_);
DCHECK(!read_in_progress_);
DCHECK(waiting_on_rewind_);
diff --git a/components/cronet/android/cronet_upload_data_stream_adapter.h b/components/cronet/android/cronet_upload_data_stream.h
index ae64314..b2ff6df 100644
--- a/components/cronet/android/cronet_upload_data_stream_adapter.h
+++ b/components/cronet/android/cronet_upload_data_stream.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef COMPONENTS_CRONET_ANDROID_CRONET_UPLOAD_DATA_STREAM_ADAPTER_H_
-#define COMPONENTS_CRONET_ANDROID_CRONET_UPLOAD_DATA_STREAM_ADAPTER_H_
+#ifndef COMPONENTS_CRONET_ANDROID_CRONET_UPLOAD_DATA_STREAM_H_
+#define COMPONENTS_CRONET_ANDROID_CRONET_UPLOAD_DATA_STREAM_H_
#include "base/basictypes.h"
#include "base/macros.h"
@@ -17,19 +17,19 @@ class IOBuffer;
namespace cronet {
-// The CronetUploadDataStreamAdapter is created on a Java thread, but
-// afterwards, lives and is deleted on the network thread. It's responsible for
-// invoking UploadDataStream's callbacks, and ensuring only one read/rewind
-// request sent to Java is outstanding at a time. The main complexity is around
-// Reset/Initialize calls while there's a pending read or rewind.
-class CronetUploadDataStreamAdapter : public net::UploadDataStream {
+// The CronetUploadDataStream is created on a Java thread, but afterwards, lives
+// and is deleted on the network thread. It's responsible for ensuring only one
+// read/rewind request sent to Java is outstanding at a time. The main
+// complexity is around Reset/Initialize calls while there's a pending read or
+// rewind.
+class CronetUploadDataStream : public net::UploadDataStream {
public:
class Delegate {
public:
// Called once during initial setup on the network thread, called before
// all other methods.
virtual void InitializeOnNetworkThread(
- base::WeakPtr<CronetUploadDataStreamAdapter> adapter) = 0;
+ base::WeakPtr<CronetUploadDataStream> upload_data_stream) = 0;
// Called for each read request. Delegate must respond by calling
// OnReadSuccess on the network thread asynchronous, or failing the request.
@@ -42,10 +42,10 @@ class CronetUploadDataStreamAdapter : public net::UploadDataStream {
// when there's no other pending read or rewind operation.
virtual void Rewind() = 0;
- // Called when the adapter is destroyed. May be called when there's a
- // pending read or rewind operation. The Delegate is then responsible for
- // destroying itself.
- virtual void OnAdapterDestroyed() = 0;
+ // Called when the CronetUploadDataStream is destroyed. The Delegate is then
+ // responsible for destroying itself. May be called when there's a pending
+ // read or rewind operation.
+ virtual void OnUploadDataStreamDestroyed() = 0;
protected:
Delegate() {}
@@ -55,8 +55,8 @@ class CronetUploadDataStreamAdapter : public net::UploadDataStream {
DISALLOW_COPY_AND_ASSIGN(Delegate);
};
- CronetUploadDataStreamAdapter(Delegate* delegate, int64 size);
- ~CronetUploadDataStreamAdapter() override;
+ CronetUploadDataStream(Delegate* delegate, int64 size);
+ ~CronetUploadDataStream() override;
// Failure is handled at the Java layer. These two success callbacks are
// invoked by Java UploadDataSink upon completion of the operation.
@@ -101,11 +101,11 @@ class CronetUploadDataStreamAdapter : public net::UploadDataStream {
Delegate* const delegate_;
// Vends pointers on the network thread, though created on a Java thread.
- base::WeakPtrFactory<CronetUploadDataStreamAdapter> weak_factory_;
+ base::WeakPtrFactory<CronetUploadDataStream> weak_factory_;
- DISALLOW_COPY_AND_ASSIGN(CronetUploadDataStreamAdapter);
+ DISALLOW_COPY_AND_ASSIGN(CronetUploadDataStream);
};
} // namespace cronet
-#endif // COMPONENTS_CRONET_ANDROID_CRONET_UPLOAD_DATA_STREAM_ADAPTER_H_
+#endif // COMPONENTS_CRONET_ANDROID_CRONET_UPLOAD_DATA_STREAM_H_
diff --git a/components/cronet/android/cronet_upload_data_stream_delegate.cc b/components/cronet/android/cronet_upload_data_stream_delegate.cc
index 3c4b006..9a8f61b 100644
--- a/components/cronet/android/cronet_upload_data_stream_delegate.cc
+++ b/components/cronet/android/cronet_upload_data_stream_delegate.cc
@@ -29,17 +29,17 @@ CronetUploadDataStreamDelegate::~CronetUploadDataStreamDelegate() {
}
void CronetUploadDataStreamDelegate::InitializeOnNetworkThread(
- base::WeakPtr<CronetUploadDataStreamAdapter> adapter) {
- DCHECK(!adapter_);
+ base::WeakPtr<CronetUploadDataStream> upload_data_stream) {
+ DCHECK(!upload_data_stream_);
DCHECK(!network_task_runner_.get());
- adapter_ = adapter;
+ upload_data_stream_ = upload_data_stream;
network_task_runner_ = base::MessageLoopProxy::current();
DCHECK(network_task_runner_);
}
void CronetUploadDataStreamDelegate::Read(net::IOBuffer* buffer, int buf_len) {
- DCHECK(adapter_);
+ DCHECK(upload_data_stream_);
DCHECK(network_task_runner_);
DCHECK(network_task_runner_->BelongsToCurrentThread());
DCHECK_GT(buf_len, 0);
@@ -56,22 +56,22 @@ void CronetUploadDataStreamDelegate::Read(net::IOBuffer* buffer, int buf_len) {
}
void CronetUploadDataStreamDelegate::Rewind() {
- DCHECK(adapter_);
+ DCHECK(upload_data_stream_);
DCHECK(network_task_runner_->BelongsToCurrentThread());
JNIEnv* env = base::android::AttachCurrentThread();
Java_CronetUploadDataStream_rewind(env, jupload_data_stream_.obj());
}
-void CronetUploadDataStreamDelegate::OnAdapterDestroyed() {
- // If the CronetUploadDataStreamAdapter was never initialized, |adapter_|
- // and |network_task_runner_| will be NULL.
+void CronetUploadDataStreamDelegate::OnUploadDataStreamDestroyed() {
+ // If CronetUploadDataStream::InitInternal was never called,
+ // |upload_data_stream_| and |network_task_runner_| will be NULL.
DCHECK(!network_task_runner_ ||
network_task_runner_->BelongsToCurrentThread());
JNIEnv* env = base::android::AttachCurrentThread();
- Java_CronetUploadDataStream_onAdapterDestroyed(env,
- jupload_data_stream_.obj());
+ Java_CronetUploadDataStream_onUploadDataStreamDestroyed(
+ env, jupload_data_stream_.obj());
}
void CronetUploadDataStreamDelegate::OnReadSucceeded(JNIEnv* env,
@@ -83,8 +83,8 @@ void CronetUploadDataStreamDelegate::OnReadSucceeded(JNIEnv* env,
buffer_ = nullptr;
network_task_runner_->PostTask(
- FROM_HERE, base::Bind(&CronetUploadDataStreamAdapter::OnReadSuccess,
- adapter_, bytes_read, final_chunk));
+ FROM_HERE, base::Bind(&CronetUploadDataStream::OnReadSuccess,
+ upload_data_stream_, bytes_read, final_chunk));
}
void CronetUploadDataStreamDelegate::OnRewindSucceeded(JNIEnv* env,
@@ -93,7 +93,8 @@ void CronetUploadDataStreamDelegate::OnRewindSucceeded(JNIEnv* env,
network_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&CronetUploadDataStreamAdapter::OnRewindSuccess, adapter_));
+ base::Bind(&CronetUploadDataStream::OnRewindSuccess,
+ upload_data_stream_));
}
bool CronetUploadDataStreamDelegateRegisterJni(JNIEnv* env) {
@@ -111,10 +112,10 @@ static jlong AttachUploadDataToRequest(JNIEnv* env,
CronetUploadDataStreamDelegate* delegate =
new CronetUploadDataStreamDelegate(env, jupload_data_stream);
- scoped_ptr<CronetUploadDataStreamAdapter> upload_adapter(
- new CronetUploadDataStreamAdapter(delegate, jlength));
+ scoped_ptr<CronetUploadDataStream> upload_data_stream(
+ new CronetUploadDataStream(delegate, jlength));
- request_adapter->SetUpload(upload_adapter.Pass());
+ request_adapter->SetUpload(upload_data_stream.Pass());
return reinterpret_cast<jlong>(delegate);
}
@@ -126,15 +127,15 @@ static jlong CreateDelegateForTesting(JNIEnv* env,
return reinterpret_cast<jlong>(delegate);
}
-static jlong CreateAdapterForTesting(JNIEnv* env,
- jobject jupload_data_stream,
- jlong jlength,
- jlong jdelegate) {
+static jlong CreateUploadDataStreamForTesting(JNIEnv* env,
+ jobject jupload_data_stream,
+ jlong jlength,
+ jlong jdelegate) {
CronetUploadDataStreamDelegate* delegate =
reinterpret_cast<CronetUploadDataStreamDelegate*>(jdelegate);
- CronetUploadDataStreamAdapter* upload_adapter =
- new CronetUploadDataStreamAdapter(delegate, jlength);
- return reinterpret_cast<jlong>(upload_adapter);
+ CronetUploadDataStream* upload_data_stream =
+ new CronetUploadDataStream(delegate, jlength);
+ return reinterpret_cast<jlong>(upload_data_stream);
}
static void DestroyDelegate(JNIEnv* env,
diff --git a/components/cronet/android/cronet_upload_data_stream_delegate.h b/components/cronet/android/cronet_upload_data_stream_delegate.h
index 1c3b9b2..f0cda52 100644
--- a/components/cronet/android/cronet_upload_data_stream_delegate.h
+++ b/components/cronet/android/cronet_upload_data_stream_delegate.h
@@ -11,7 +11,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "components/cronet/android/cronet_upload_data_stream_adapter.h"
+#include "components/cronet/android/cronet_upload_data_stream.h"
#include "net/base/io_buffer.h"
namespace base {
@@ -25,26 +25,24 @@ namespace cronet {
// has completed.
//
// The Delegate is owned by the Java CronetUploadDataStream, and also owns a
-// reference to it. The Delegate is only destroyed after the URLRequest
-// destroys the adapter and the CronetUploadDataStream has no read operation
-// pending, at which point it also releases its reference to the
-// CronetUploadDataStream.
+// reference to it. The Delegate is only destroyed after the net::URLRequest
+// destroys the C++ CronetUploadDataStream and the Java CronetUploadDataStream
+// has no read operation pending, at which point it also releases its reference
+// to the Java CronetUploadDataStream.
//
// Failures don't go through the delegate, but directly to the Java request
// object, since normally reads aren't allowed to fail during an upload.
-class CronetUploadDataStreamDelegate
- : public CronetUploadDataStreamAdapter::Delegate {
+class CronetUploadDataStreamDelegate : public CronetUploadDataStream::Delegate {
public:
CronetUploadDataStreamDelegate(JNIEnv* env, jobject jupload_data_stream);
~CronetUploadDataStreamDelegate() override;
- // CronetUploadDataStreamAdapter::Delegate implementation. Called on network
- // thread.
+ // CronetUploadDataStream::Delegate implementation. Called on network thread.
void InitializeOnNetworkThread(
- base::WeakPtr<CronetUploadDataStreamAdapter> adapter) override;
+ base::WeakPtr<CronetUploadDataStream> upload_data_stream) override;
void Read(net::IOBuffer* buffer, int buf_len) override;
void Rewind() override;
- void OnAdapterDestroyed() override;
+ void OnUploadDataStreamDestroyed() override;
// Callbacks from Java, called on some Java thread.
void OnReadSucceeded(JNIEnv* env,
@@ -60,7 +58,7 @@ class CronetUploadDataStreamDelegate
// These are initialized in InitializeOnNetworkThread, so are safe to access
// during Java callbacks, which all happen after initialization.
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
- base::WeakPtr<CronetUploadDataStreamAdapter> adapter_;
+ base::WeakPtr<CronetUploadDataStream> upload_data_stream_;
// Used to keep the read buffer alive until the callback from Java has been
// received.
diff --git a/components/cronet/android/java/src/org/chromium/net/CronetUploadDataStream.java b/components/cronet/android/java/src/org/chromium/net/CronetUploadDataStream.java
index 0427c40..37864f5 100644
--- a/components/cronet/android/java/src/org/chromium/net/CronetUploadDataStream.java
+++ b/components/cronet/android/java/src/org/chromium/net/CronetUploadDataStream.java
@@ -52,9 +52,9 @@ final class CronetUploadDataStream implements UploadDataSink {
// to robustly detect getting read/rewind results more often than expected.
private final Object mLock = new Object();
- // Native adapter delegate object, owned by the CronetUploadDataStream.
- // It's only deleted after the native UploadDataStream object is destroyed.
- // All access to the delegate is synchronized, for safe usage and cleanup.
+ // Native delegate object, owned by the CronetUploadDataStream. It's only
+ // deleted after the native UploadDataStream object is destroyed. All access
+ // to the delegate is synchronized, for safe usage and cleanup.
private long mUploadDataStreamDelegate = 0;
private boolean mReading = false;
@@ -115,12 +115,13 @@ final class CronetUploadDataStream implements UploadDataSink {
}
/**
- * Called by native code to destroy the native adapter delegate, when the
- * adapter is destroyed.
+ * Called when the native UploadDataStream is destroyed. At this point,
+ * the native delegate needs to be destroyed, but only after any pending
+ * read operation completes, as the delegate owns the read buffer.
*/
@SuppressWarnings("unused")
@CalledByNative
- void onAdapterDestroyed() {
+ void onUploadDataStreamDestroyed() {
Runnable task = new Runnable() {
@Override
public void run() {
@@ -149,8 +150,8 @@ final class CronetUploadDataStream implements UploadDataSink {
// Just fail the request - simpler to fail directly, and
// UploadDataStream only supports failing during initialization, not
- // while reading. This should be safe, even if we deleted the adapter,
- // because in that case, the request has already been cancelled.
+ // while reading. The request is smart enough to handle the case where
+ // it was already cancelled by the embedder.
mRequest.onUploadException(exception);
}
@@ -266,23 +267,24 @@ final class CronetUploadDataStream implements UploadDataSink {
}
/**
- * Creates a native UploadDataStreamDelegate and UploadDataStreamAdapter
- * for testing.
- * @return the address of the native CronetUploadDataStreamAdapter object.
+ * Creates a native CronetUploadDataStreamDelegate and
+ * CronetUploadDataStream for testing.
+ * @return the address of the native CronetUploadDataStream object.
*/
- public long createAdapterForTesting() {
+ public long createUploadDataStreamForTesting() {
mUploadDataStreamDelegate = nativeCreateDelegateForTesting();
- return nativeCreateAdapterForTesting(mLength, mUploadDataStreamDelegate);
+ return nativeCreateUploadDataStreamForTesting(mLength,
+ mUploadDataStreamDelegate);
}
- // Native methods are implemented in upload_data_stream_adapter.cc.
+ // Native methods are implemented in upload_data_stream.cc.
private native long nativeAttachUploadDataToRequest(long urlRequestAdapter,
long length);
private native long nativeCreateDelegateForTesting();
- private native long nativeCreateAdapterForTesting(long length,
+ private native long nativeCreateUploadDataStreamForTesting(long length,
long delegate);
@NativeClassQualifiedName("CronetUploadDataStreamDelegate")
diff --git a/components/cronet/android/test/javatests/src/org/chromium/net/CronetUploadTest.java b/components/cronet/android/test/javatests/src/org/chromium/net/CronetUploadTest.java
index 074eaad..8f0b6a5 100644
--- a/components/cronet/android/test/javatests/src/org/chromium/net/CronetUploadTest.java
+++ b/components/cronet/android/test/javatests/src/org/chromium/net/CronetUploadTest.java
@@ -32,7 +32,7 @@ public class CronetUploadTest extends CronetTestBase {
mDataProvider = new TestDrivenDataProvider(executor, reads);
mUploadDataStream = new CronetUploadDataStream(mDataProvider, executor);
mHandler = new TestUploadDataStreamHandler(
- mUploadDataStream.createAdapterForTesting());
+ mUploadDataStream.createUploadDataStreamForTesting());
}
@Override
@@ -223,15 +223,15 @@ public class CronetUploadTest extends CronetTestBase {
}
/**
- * Tests that there is no crash when native CronetUploadDataStreamAdapter is
- * destroyed while read is pending. The test is racy since read could
- * complete either before or after onDestroyAdapter() is called in
- * CronetUploadDataStream. However, the test should pass either way, though
- * we are interested in the latter case.
+ * Tests that there is no crash when native CronetUploadDataStream is
+ * destroyed while read is pending. The test is racy since the read could
+ * complete either before or after the Java CronetUploadDataStream's
+ * onDestroyUploadDataStream() method is invoked. However, the test should
+ * pass either way, though we are interested in the latter case.
*/
@SmallTest
@Feature({"Cronet"})
- public void testDestroyAdapterBeforeReadComplete()
+ public void testDestroyNativeStreamBeforeReadComplete()
throws Exception {
// Start a read and wait for it to be pending.
assertTrue(mHandler.init());
@@ -239,12 +239,11 @@ public class CronetUploadTest extends CronetTestBase {
mDataProvider.waitForReadRequest();
mHandler.checkReadCallbackNotInvoked();
- // Destroy the C++ TestUploadDataStreamHandler. The handler owns the
- // CronetUploadDataStreamAdapter, which this will cause it to destroy on
- // the network thread. Destroying the adapter will result in calling
- // the CronetUploadDataSteam's onAdapterDestroyed() method on its
- // executor thread, which will then destroy the
- // CronetUploadDataStreamDelegate.
+ // Destroy the C++ TestUploadDataStreamHandler. The handler will then
+ // destroy the C++ CronetUploadDataStream it owns on the network thread.
+ // That will result in calling the Java CronetUploadDataSteam's
+ // onCanceled() method on its executor thread, which will then destroy
+ // the CronetUploadDataStreamDelegate.
mHandler.destroyNativeObjects();
// Make the read complete should not encounter a crash.
@@ -255,15 +254,15 @@ public class CronetUploadTest extends CronetTestBase {
}
/**
- * Tests that there is no crash when native CronetUploadDataStreamAdapter is
+ * Tests that there is no crash when native CronetUploadDataStream is
* destroyed while rewind is pending. The test is racy since rewind could
- * complete either before or after onDestroyAdapter() is called in
- * CronetUploadDataStream. However, the test should pass either way, though
- * we are interested in the latter case.
+ * complete either before or after the Java CronetUploadDataStream's
+ * onDestroyUploadDataStream() method is invoked. However, the test should
+ * pass either way, though we are interested in the latter case.
*/
@SmallTest
@Feature({"Cronet"})
- public void testDestroyAdapterBeforeRewindComplete()
+ public void testDestroyNativeStreamBeforeRewindComplete()
throws Exception {
// Start a read and wait for it to complete.
assertTrue(mHandler.init());
@@ -284,12 +283,11 @@ public class CronetUploadTest extends CronetTestBase {
mDataProvider.waitForRewindRequest();
mHandler.checkInitCallbackNotInvoked();
- // Destroy the C++ TestUploadDataStreamHandler. The handler owns the
- // CronetUploadDataStreamAdapter, which this will cause it to destroy on
- // the network thread. Destroying the adapter will result in calling
- // the CronetUploadDataSteam's onAdapterDestroyed() method on its
- // executor thread, which will then destroy the
- // CronetUploadDataStreamDelegate.
+ // Destroy the C++ TestUploadDataStreamHandler. The handler will then
+ // destroy the C++ CronetUploadDataStream it owns on the network thread.
+ // That will result in calling the Java CronetUploadDataSteam's
+ // onCanceled() method on its executor thread, which will then destroy
+ // the CronetUploadDataStreamDelegate.
mHandler.destroyNativeObjects();
// Signal rewind completes, and wait for init to complete.
diff --git a/components/cronet/cronet_static.gypi b/components/cronet/cronet_static.gypi
index c591fff..fa0d983 100644
--- a/components/cronet/cronet_static.gypi
+++ b/components/cronet/cronet_static.gypi
@@ -25,12 +25,12 @@
'android/cronet_data_reduction_proxy.h',
'android/cronet_histogram_manager.cc',
'android/cronet_histogram_manager.h',
- 'android/cronet_library_loader.cc',
- 'android/cronet_library_loader.h',
'android/cronet_in_memory_pref_store.cc',
'android/cronet_in_memory_pref_store.h',
- 'android/cronet_upload_data_stream_adapter.cc',
- 'android/cronet_upload_data_stream_adapter.h',
+ 'android/cronet_library_loader.cc',
+ 'android/cronet_library_loader.h',
+ 'android/cronet_upload_data_stream.cc',
+ 'android/cronet_upload_data_stream.h',
'android/cronet_upload_data_stream_delegate.cc',
'android/cronet_upload_data_stream_delegate.h',
'android/cronet_url_request_adapter.cc',