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

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

Issue 6519057: Implement proxying for FileRef and FileChooser.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fix ppapi tests to account for query change Created 9 years, 10 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 | « ppapi/proxy/ppb_file_ref_proxy.cc ('k') | ppapi/proxy/serialized_structs.h » ('j') | 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) 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 bytes_sent_(-1), 62 bytes_sent_(-1),
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.
73 if (current_read_callback_.func)
74 PP_RunCompletionCallback(&current_read_callback_, PP_ERROR_ABORTED);
75
72 if (response_info_) 76 if (response_info_)
73 PluginResourceTracker::GetInstance()->ReleaseResource(response_info_); 77 PluginResourceTracker::GetInstance()->ReleaseResource(response_info_);
74 } 78 }
75 79
76 PP_Resource URLLoader::GetResponseInfo() { 80 PP_Resource URLLoader::GetResponseInfo() {
77 if (!response_info_) { 81 if (!response_info_) {
78 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance()); 82 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance());
79 if (!dispatcher) 83 if (!dispatcher)
80 return 0; 84 return 0;
81 85
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 } 362 }
359 363
360 void PPB_URLLoader_Proxy::OnMsgOpen(const HostResource& loader, 364 void PPB_URLLoader_Proxy::OnMsgOpen(const HostResource& loader,
361 const HostResource& request_info, 365 const HostResource& request_info,
362 uint32_t serialized_callback) { 366 uint32_t serialized_callback) {
363 PP_CompletionCallback callback = ReceiveCallback(serialized_callback); 367 PP_CompletionCallback callback = ReceiveCallback(serialized_callback);
364 int32_t result = ppb_url_loader_target()->Open( 368 int32_t result = ppb_url_loader_target()->Open(
365 loader.host_resource(), request_info.host_resource(), callback); 369 loader.host_resource(), request_info.host_resource(), callback);
366 if (result != PP_ERROR_WOULDBLOCK) 370 if (result != PP_ERROR_WOULDBLOCK)
367 PP_RunCompletionCallback(&callback, result); 371 PP_RunCompletionCallback(&callback, result);
372 // TODO(brettw) bug 73236 register for the status callbacks.
368 } 373 }
369 374
370 void PPB_URLLoader_Proxy::OnMsgFollowRedirect( 375 void PPB_URLLoader_Proxy::OnMsgFollowRedirect(
371 const HostResource& loader, 376 const HostResource& loader,
372 uint32_t serialized_callback) { 377 uint32_t serialized_callback) {
373 PP_CompletionCallback callback = ReceiveCallback(serialized_callback); 378 PP_CompletionCallback callback = ReceiveCallback(serialized_callback);
374 int32_t result = ppb_url_loader_target()->FollowRedirect( 379 int32_t result = ppb_url_loader_target()->FollowRedirect(
375 loader.host_resource(), callback); 380 loader.host_resource(), callback);
376 if (result != PP_ERROR_WOULDBLOCK) 381 if (result != PP_ERROR_WOULDBLOCK)
377 PP_RunCompletionCallback(&callback, result); 382 PP_RunCompletionCallback(&callback, result);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 return handled; 532 return handled;
528 } 533 }
529 534
530 void PPB_URLLoaderTrusted_Proxy::OnMsgGrantUniversalAccess( 535 void PPB_URLLoaderTrusted_Proxy::OnMsgGrantUniversalAccess(
531 const HostResource& loader) { 536 const HostResource& loader) {
532 ppb_url_loader_trusted_target()->GrantUniversalAccess(loader.host_resource()); 537 ppb_url_loader_trusted_target()->GrantUniversalAccess(loader.host_resource());
533 } 538 }
534 539
535 } // namespace proxy 540 } // namespace proxy
536 } // namespace pp 541 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_file_ref_proxy.cc ('k') | ppapi/proxy/serialized_structs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698