| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ppb_url_loader_proxy.h" | 5 #include "ppapi/proxy/ppb_url_loader_proxy.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 total_bytes_to_be_sent_(-1), | 63 total_bytes_to_be_sent_(-1), |
| 64 bytes_received_(-1), | 64 bytes_received_(-1), |
| 65 total_bytes_to_be_received_(-1), | 65 total_bytes_to_be_received_(-1), |
| 66 current_read_callback_(PP_MakeCompletionCallback(NULL, NULL)), | 66 current_read_callback_(PP_MakeCompletionCallback(NULL, NULL)), |
| 67 current_read_buffer_(NULL), | 67 current_read_buffer_(NULL), |
| 68 response_info_(0) { | 68 response_info_(0) { |
| 69 } | 69 } |
| 70 | 70 |
| 71 URLLoader::~URLLoader() { | 71 URLLoader::~URLLoader() { |
| 72 // Always need to fire completion callbacks to prevent a leak in the plugin. | 72 // Always need to fire completion callbacks to prevent a leak in the plugin. |
| 73 if (current_read_callback_.func) | 73 if (current_read_callback_.func) { |
| 74 PP_RunCompletionCallback(¤t_read_callback_, PP_ERROR_ABORTED); | 74 // TODO(brettw) the callbacks at this level should be refactored with a |
| 75 // more automatic tracking system like we have in the renderer. |
| 76 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableFunction( |
| 77 current_read_callback_.func, current_read_callback_.user_data, |
| 78 static_cast<int32_t>(PP_ERROR_ABORTED))); |
| 79 } |
| 75 | 80 |
| 76 if (response_info_) | 81 if (response_info_) |
| 77 PluginResourceTracker::GetInstance()->ReleaseResource(response_info_); | 82 PluginResourceTracker::GetInstance()->ReleaseResource(response_info_); |
| 78 } | 83 } |
| 79 | 84 |
| 80 PP_Resource URLLoader::GetResponseInfo() { | 85 PP_Resource URLLoader::GetResponseInfo() { |
| 81 if (!response_info_) { | 86 if (!response_info_) { |
| 82 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance()); | 87 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance()); |
| 83 if (!dispatcher) | 88 if (!dispatcher) |
| 84 return 0; | 89 return 0; |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 return handled; | 537 return handled; |
| 533 } | 538 } |
| 534 | 539 |
| 535 void PPB_URLLoaderTrusted_Proxy::OnMsgGrantUniversalAccess( | 540 void PPB_URLLoaderTrusted_Proxy::OnMsgGrantUniversalAccess( |
| 536 const HostResource& loader) { | 541 const HostResource& loader) { |
| 537 ppb_url_loader_trusted_target()->GrantUniversalAccess(loader.host_resource()); | 542 ppb_url_loader_trusted_target()->GrantUniversalAccess(loader.host_resource()); |
| 538 } | 543 } |
| 539 | 544 |
| 540 } // namespace proxy | 545 } // namespace proxy |
| 541 } // namespace pp | 546 } // namespace pp |
| OLD | NEW |