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

Side by Side Diff: plugin/npapi_host_control/win/stream_operation.cc

Issue 149434: Avoid calling Abort from main thread on IBinding created on another thread. I... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Created 11 years, 5 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 | « plugin/npapi_host_control/win/stream_operation.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009, Google Inc. All rights reserved. 1 // Copyright 2009, Google Inc. All rights reserved.
2 // Portions of this file were adapted from the Mozilla project. 2 // Portions of this file were adapted from the Mozilla project.
3 // See https://developer.mozilla.org/en/ActiveX_Control_for_Hosting_Netscape_Plu g-ins_in_IE 3 // See https://developer.mozilla.org/en/ActiveX_Control_for_Hosting_Netscape_Plu g-ins_in_IE
4 /* ***** BEGIN LICENSE BLOCK ***** 4 /* ***** BEGIN LICENSE BLOCK *****
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * 6 *
7 * The contents of this file are subject to the Mozilla Public License Version 7 * The contents of this file are subject to the Mozilla Public License Version
8 * 1.1 (the "License"); you may not use this file except in compliance with 8 * 1.1 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at 9 * the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/ 10 * http://www.mozilla.org/MPL/
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } 260 }
261 261
262 HRESULT STDMETHODCALLTYPE StreamOperation::OnLowResource(DWORD reserved) { 262 HRESULT STDMETHODCALLTYPE StreamOperation::OnLowResource(DWORD reserved) {
263 return S_OK; 263 return S_OK;
264 } 264 }
265 265
266 HRESULT STDMETHODCALLTYPE StreamOperation::OnProgress(ULONG ulProgress, 266 HRESULT STDMETHODCALLTYPE StreamOperation::OnProgress(ULONG ulProgress,
267 ULONG ulProgressMax, 267 ULONG ulProgressMax,
268 ULONG ulStatusCode, 268 ULONG ulStatusCode,
269 LPCWSTR szStatusText) { 269 LPCWSTR szStatusText) {
270 if (cancel_requested_) {
271 binding_->Abort();
272 return S_OK;
273 }
274
270 // Capture URL re-directs and MIME-type status notifications. 275 // Capture URL re-directs and MIME-type status notifications.
271 switch (ulStatusCode) { 276 switch (ulStatusCode) {
272 case BINDSTATUS_BEGINDOWNLOADDATA: 277 case BINDSTATUS_BEGINDOWNLOADDATA:
273 case BINDSTATUS_REDIRECTING: 278 case BINDSTATUS_REDIRECTING:
274 url_ = szStatusText; 279 url_ = szStatusText;
275 break; 280 break;
276 case BINDSTATUS_MIMETYPEAVAILABLE: 281 case BINDSTATUS_MIMETYPEAVAILABLE:
277 content_type_ = szStatusText; 282 content_type_ = szStatusText;
278 break; 283 break;
279 default: 284 default:
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 DWORD grfBSCF, 364 DWORD grfBSCF,
360 DWORD dwSize, 365 DWORD dwSize,
361 FORMATETC *pformatetc, 366 FORMATETC *pformatetc,
362 STGMEDIUM *pstgmed) { 367 STGMEDIUM *pstgmed) {
363 if (pstgmed->tymed != TYMED_ISTREAM || !pstgmed->pstm) { 368 if (pstgmed->tymed != TYMED_ISTREAM || !pstgmed->pstm) {
364 return S_OK; 369 return S_OK;
365 } 370 }
366 371
367 // Don't bother processing any data if the stream has been canceled. 372 // Don't bother processing any data if the stream has been canceled.
368 if (cancel_requested_) { 373 if (cancel_requested_) {
374 binding_->Abort();
369 return S_OK; 375 return S_OK;
370 } 376 }
371 377
372 // Notify the plugin that a new stream has been opened. 378 // Notify the plugin that a new stream has been opened.
373 if (grfBSCF & BSCF_FIRSTDATANOTIFICATION) { 379 if (grfBSCF & BSCF_FIRSTDATANOTIFICATION) {
374 USES_CONVERSION; 380 USES_CONVERSION;
375 np_stream_.url = W2CA(url_); 381 np_stream_.url = W2CA(url_);
376 np_stream_.end = stream_size_; 382 np_stream_.end = stream_size_;
377 np_stream_.lastmodified = 0; 383 np_stream_.lastmodified = 0;
378 np_stream_.notifyData = GetNotifyData(); 384 np_stream_.notifyData = GetNotifyData();
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 HANDLE* event_handle = reinterpret_cast<HANDLE*>(wParam); 748 HANDLE* event_handle = reinterpret_cast<HANDLE*>(wParam);
743 SetEvent(*event_handle); 749 SetEvent(*event_handle);
744 } 750 }
745 return 0; 751 return 0;
746 } 752 }
747 753
748 HRESULT StreamOperation::RequestCancellation() { 754 HRESULT StreamOperation::RequestCancellation() {
749 ATLASSERT(binding_ && 755 ATLASSERT(binding_ &&
750 "Cancellation request on a stream that has not been bound."); 756 "Cancellation request on a stream that has not been bound.");
751 cancel_requested_ = true; 757 cancel_requested_ = true;
752 if (binding_) {
753 return binding_->Abort();
754 }
755 return S_OK; 758 return S_OK;
756 } 759 }
OLDNEW
« no previous file with comments | « plugin/npapi_host_control/win/stream_operation.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698