OLD | NEW |
---|---|
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 Loading... | |
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 URLLoaderResource can cause the page to tear down the plugin | |
yzshen1
2013/09/06 22:07:47
I don't quite understand under what circumstances
| |
72 // instance. For in-process plugins, this can happen before the base Resource | |
73 // class destructor runs, which removes this from the resource tracker. The | |
74 // instance tear down code will then attempt to call methods on this partially | |
75 // destructed object. Remove this from the tracker early to avoid this. | |
76 RemoveFromResourceTracker(); | |
71 } | 77 } |
72 | 78 |
73 PPB_URLLoader_API* URLLoaderResource::AsPPB_URLLoader_API() { | 79 PPB_URLLoader_API* URLLoaderResource::AsPPB_URLLoader_API() { |
74 return this; | 80 return this; |
75 } | 81 } |
76 | 82 |
77 int32_t URLLoaderResource::Open(PP_Resource request_id, | 83 int32_t URLLoaderResource::Open(PP_Resource request_id, |
78 scoped_refptr<TrackedCallback> callback) { | 84 scoped_refptr<TrackedCallback> callback) { |
79 EnterResourceNoLock<PPB_URLRequestInfo_API> enter_request(request_id, true); | 85 EnterResourceNoLock<PPB_URLRequestInfo_API> enter_request(request_id, true); |
80 if (enter_request.failed()) { | 86 if (enter_request.failed()) { |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 } | 389 } |
384 | 390 |
385 // Reset for next time. | 391 // Reset for next time. |
386 user_buffer_ = NULL; | 392 user_buffer_ = NULL; |
387 user_buffer_size_ = 0; | 393 user_buffer_size_ = 0; |
388 return bytes_to_copy; | 394 return bytes_to_copy; |
389 } | 395 } |
390 | 396 |
391 } // namespace proxy | 397 } // namespace proxy |
392 } // namespace ppapi | 398 } // namespace ppapi |
OLD | NEW |