summaryrefslogtreecommitdiffstats
path: root/o3d
diff options
context:
space:
mode:
authorapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-10 18:00:26 +0000
committerapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-10 18:00:26 +0000
commit879119be1fc053e493937c7562524140ad2f54f3 (patch)
treeb141e055634378077a525d99041d35633e59e08f /o3d
parent415493bea409a054a89b153abf3e508842f1d73c (diff)
downloadchromium_src-879119be1fc053e493937c7562524140ad2f54f3.zip
chromium_src-879119be1fc053e493937c7562524140ad2f54f3.tar.gz
chromium_src-879119be1fc053e493937c7562524140ad2f54f3.tar.bz2
Avoid calling Abort from main thread on IBinding created on another thread. Instead signal through a variable and wait for it to abort itself.
Review URL: http://codereview.chromium.org/149434 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20384 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r--o3d/plugin/npapi_host_control/win/stream_operation.cc9
-rw-r--r--o3d/plugin/npapi_host_control/win/stream_operation.h7
2 files changed, 9 insertions, 7 deletions
diff --git a/o3d/plugin/npapi_host_control/win/stream_operation.cc b/o3d/plugin/npapi_host_control/win/stream_operation.cc
index 9cfed9e..31f1c5c 100644
--- a/o3d/plugin/npapi_host_control/win/stream_operation.cc
+++ b/o3d/plugin/npapi_host_control/win/stream_operation.cc
@@ -267,6 +267,11 @@ HRESULT STDMETHODCALLTYPE StreamOperation::OnProgress(ULONG ulProgress,
ULONG ulProgressMax,
ULONG ulStatusCode,
LPCWSTR szStatusText) {
+ if (cancel_requested_) {
+ binding_->Abort();
+ return S_OK;
+ }
+
// Capture URL re-directs and MIME-type status notifications.
switch (ulStatusCode) {
case BINDSTATUS_BEGINDOWNLOADDATA:
@@ -366,6 +371,7 @@ HRESULT STDMETHODCALLTYPE StreamOperation::OnDataAvailable(
// Don't bother processing any data if the stream has been canceled.
if (cancel_requested_) {
+ binding_->Abort();
return S_OK;
}
@@ -749,8 +755,5 @@ HRESULT StreamOperation::RequestCancellation() {
ATLASSERT(binding_ &&
"Cancellation request on a stream that has not been bound.");
cancel_requested_ = true;
- if (binding_) {
- return binding_->Abort();
- }
return S_OK;
}
diff --git a/o3d/plugin/npapi_host_control/win/stream_operation.h b/o3d/plugin/npapi_host_control/win/stream_operation.h
index 8149b81..c74f436 100644
--- a/o3d/plugin/npapi_host_control/win/stream_operation.h
+++ b/o3d/plugin/npapi_host_control/win/stream_operation.h
@@ -122,10 +122,9 @@ class ATL_NO_VTABLE StreamOperation :
return notify_data_;
}
- // Call to request that the streaming operation terminate early. After this
- // has been called, no further data notifications will take place. The next,
- // and last notification will be through
- // IBindStatusCallback::OnStopBinding(...).
+ // Call to request that the streaming operation terminate early. As soon as
+ // the streaming thread sees the request has been cancelled, it aborts its
+ // binding.
HRESULT RequestCancellation();
BEGIN_COM_MAP(StreamOperation)