OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "ppapi/proxy/ppb_url_response_info_proxy.h" | 24 #include "ppapi/proxy/ppb_url_response_info_proxy.h" |
25 #include "ppapi/thunk/enter.h" | 25 #include "ppapi/thunk/enter.h" |
26 #include "ppapi/thunk/ppb_url_loader_api.h" | 26 #include "ppapi/thunk/ppb_url_loader_api.h" |
27 #include "ppapi/thunk/resource_creation_api.h" | 27 #include "ppapi/thunk/resource_creation_api.h" |
28 #include "ppapi/thunk/thunk.h" | 28 #include "ppapi/thunk/thunk.h" |
29 | 29 |
30 #if defined(OS_LINUX) | 30 #if defined(OS_LINUX) |
31 #include <sys/shm.h> | 31 #include <sys/shm.h> |
32 #endif | 32 #endif |
33 | 33 |
34 using ppapi::HostResource; | |
35 using ppapi::Resource; | |
36 using ppapi::thunk::EnterFunctionNoLock; | 34 using ppapi::thunk::EnterFunctionNoLock; |
37 using ppapi::thunk::EnterResourceNoLock; | 35 using ppapi::thunk::EnterResourceNoLock; |
38 using ppapi::thunk::PPB_URLLoader_API; | 36 using ppapi::thunk::PPB_URLLoader_API; |
39 using ppapi::thunk::ResourceCreationAPI; | 37 using ppapi::thunk::ResourceCreationAPI; |
40 | 38 |
41 namespace pp { | 39 namespace ppapi { |
42 namespace proxy { | 40 namespace proxy { |
43 | 41 |
44 namespace { | 42 namespace { |
45 | 43 |
46 // The maximum size we'll read into the plugin without being explicitly | 44 // The maximum size we'll read into the plugin without being explicitly |
47 // asked for a larger buffer. | 45 // asked for a larger buffer. |
48 const int32_t kMaxReadBufferSize = 16777216; // 16MB | 46 const int32_t kMaxReadBufferSize = 16777216; // 16MB |
49 | 47 |
50 // Called in the renderer when the byte counts have changed. We send a message | 48 // Called in the renderer when the byte counts have changed. We send a message |
51 // to the plugin to synchronize its counts so it can respond to status polls | 49 // to the plugin to synchronize its counts so it can respond to status polls |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 | 359 |
362 // static | 360 // static |
363 PP_Resource PPB_URLLoader_Proxy::TrackPluginResource( | 361 PP_Resource PPB_URLLoader_Proxy::TrackPluginResource( |
364 const HostResource& url_loader_resource) { | 362 const HostResource& url_loader_resource) { |
365 return (new URLLoader(url_loader_resource))->GetReference(); | 363 return (new URLLoader(url_loader_resource))->GetReference(); |
366 } | 364 } |
367 | 365 |
368 // static | 366 // static |
369 const InterfaceProxy::Info* PPB_URLLoader_Proxy::GetInfo() { | 367 const InterfaceProxy::Info* PPB_URLLoader_Proxy::GetInfo() { |
370 static const Info info = { | 368 static const Info info = { |
371 ::ppapi::thunk::GetPPB_URLLoader_Thunk(), | 369 thunk::GetPPB_URLLoader_Thunk(), |
372 PPB_URLLOADER_INTERFACE, | 370 PPB_URLLOADER_INTERFACE, |
373 INTERFACE_ID_PPB_URL_LOADER, | 371 INTERFACE_ID_PPB_URL_LOADER, |
374 false, | 372 false, |
375 &CreateURLLoaderProxy, | 373 &CreateURLLoaderProxy, |
376 }; | 374 }; |
377 return &info; | 375 return &info; |
378 } | 376 } |
379 | 377 |
380 // static | 378 // static |
381 const InterfaceProxy::Info* PPB_URLLoader_Proxy::GetTrustedInfo() { | 379 const InterfaceProxy::Info* PPB_URLLoader_Proxy::GetTrustedInfo() { |
382 static const Info info = { | 380 static const Info info = { |
383 ::ppapi::thunk::GetPPB_URLLoaderTrusted_Thunk(), | 381 thunk::GetPPB_URLLoaderTrusted_Thunk(), |
384 PPB_URLLOADERTRUSTED_INTERFACE, | 382 PPB_URLLOADERTRUSTED_INTERFACE, |
385 INTERFACE_ID_NONE, // URL_LOADER is the canonical one. | 383 INTERFACE_ID_NONE, // URL_LOADER is the canonical one. |
386 false, | 384 false, |
387 &CreateURLLoaderProxy | 385 &CreateURLLoaderProxy |
388 }; | 386 }; |
389 return &info; | 387 return &info; |
390 } | 388 } |
391 | 389 |
392 // static | 390 // static |
393 PP_Resource PPB_URLLoader_Proxy::CreateProxyResource(PP_Instance pp_instance) { | 391 PP_Resource PPB_URLLoader_Proxy::CreateProxyResource(PP_Instance pp_instance) { |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 bytes_read = result; // Positive results indicate bytes read. | 578 bytes_read = result; // Positive results indicate bytes read. |
581 info->read_buffer.resize(bytes_read); | 579 info->read_buffer.resize(bytes_read); |
582 | 580 |
583 dispatcher()->Send(new PpapiMsg_PPBURLLoader_ReadResponseBody_Ack( | 581 dispatcher()->Send(new PpapiMsg_PPBURLLoader_ReadResponseBody_Ack( |
584 INTERFACE_ID_PPB_URL_LOADER, info->resource, result, info->read_buffer)); | 582 INTERFACE_ID_PPB_URL_LOADER, info->resource, result, info->read_buffer)); |
585 | 583 |
586 delete info; | 584 delete info; |
587 } | 585 } |
588 | 586 |
589 } // namespace proxy | 587 } // namespace proxy |
590 } // namespace pp | 588 } // namespace ppapi |
OLD | NEW |