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

Side by Side Diff: ppapi/proxy/url_loader_resource.cc

Issue 23688004: Change the PepperInProcessRouter to defer resource destruction messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More detailed comment, only change in-process behavior. Created 7 years, 3 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 | « no previous file | 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "ppapi/proxy/url_loader_resource.h" 5 #include "ppapi/proxy/url_loader_resource.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/c/pp_completion_callback.h" 8 #include "ppapi/c/pp_completion_callback.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/c/ppb_url_loader.h" 10 #include "ppapi/c/ppb_url_loader.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 user_buffer_(NULL), 61 user_buffer_(NULL),
62 user_buffer_size_(0), 62 user_buffer_size_(0),
63 done_status_(PP_OK_COMPLETIONPENDING), 63 done_status_(PP_OK_COMPLETIONPENDING),
64 is_streaming_to_file_(false), 64 is_streaming_to_file_(false),
65 is_asynchronous_load_suspended_(false) { 65 is_asynchronous_load_suspended_(false) {
66 AttachToPendingHost(RENDERER, pending_main_document_loader_id); 66 AttachToPendingHost(RENDERER, pending_main_document_loader_id);
67 SaveResponseInfo(data); 67 SaveResponseInfo(data);
68 } 68 }
69 69
70 URLLoaderResource::~URLLoaderResource() { 70 URLLoaderResource::~URLLoaderResource() {
71 // Destroying a loader will cancel a pending load which causes the document
72 // ready state to change. A page may respond to that event by destroying the
73 // plugin instance. For in-process plugins, this can re-enter the proxy code
74 // before the base Resource destructor removes the loader from the resource
75 // tracker. The instance cleanup code will then attempt to call methods on
76 // this partially destructed object. Remove the loader from the tracker now
77 // to avoid this.
78 if (PpapiGlobals::Get()->GetProxyLock() == NULL)
Tom Sepez 2013/09/09 21:05:01 nit: (!PpapiGlobals::Get()->GetProxyLock())
79 RemoveFromResourceTracker();
71 } 80 }
72 81
73 PPB_URLLoader_API* URLLoaderResource::AsPPB_URLLoader_API() { 82 PPB_URLLoader_API* URLLoaderResource::AsPPB_URLLoader_API() {
74 return this; 83 return this;
75 } 84 }
76 85
77 int32_t URLLoaderResource::Open(PP_Resource request_id, 86 int32_t URLLoaderResource::Open(PP_Resource request_id,
78 scoped_refptr<TrackedCallback> callback) { 87 scoped_refptr<TrackedCallback> callback) {
79 EnterResourceNoLock<PPB_URLRequestInfo_API> enter_request(request_id, true); 88 EnterResourceNoLock<PPB_URLRequestInfo_API> enter_request(request_id, true);
80 if (enter_request.failed()) { 89 if (enter_request.failed()) {
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 } 392 }
384 393
385 // Reset for next time. 394 // Reset for next time.
386 user_buffer_ = NULL; 395 user_buffer_ = NULL;
387 user_buffer_size_ = 0; 396 user_buffer_size_ = 0;
388 return bytes_to_copy; 397 return bytes_to_copy;
389 } 398 }
390 399
391 } // namespace proxy 400 } // namespace proxy
392 } // namespace ppapi 401 } // namespace ppapi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698