OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shared_impl/url_request_info_data.h" | 5 #include "ppapi/shared_impl/url_request_info_data.h" |
6 | 6 |
| 7 #include <stdio.h> |
7 #include "ppapi/shared_impl/resource.h" | 8 #include "ppapi/shared_impl/resource.h" |
8 | 9 |
9 namespace ppapi { | 10 namespace ppapi { |
10 | 11 |
11 namespace { | 12 namespace { |
12 | 13 |
13 const int32_t kDefaultPrefetchBufferUpperThreshold = 100 * 1000 * 1000; | 14 const int32_t kDefaultPrefetchBufferUpperThreshold = 100 * 1000 * 1000; |
14 const int32_t kDefaultPrefetchBufferLowerThreshold = 50 * 1000 * 1000; | 15 const int32_t kDefaultPrefetchBufferLowerThreshold = 50 * 1000 * 1000; |
15 | 16 |
16 } // namespace | 17 } // namespace |
(...skipping 12 matching lines...) Expand all Loading... |
29 number_of_bytes(-1), | 30 number_of_bytes(-1), |
30 expected_last_modified_time(0.0) { | 31 expected_last_modified_time(0.0) { |
31 } | 32 } |
32 | 33 |
33 URLRequestInfoData::BodyItem::BodyItem( | 34 URLRequestInfoData::BodyItem::BodyItem( |
34 Resource* file_ref, | 35 Resource* file_ref, |
35 int64_t start_offset, | 36 int64_t start_offset, |
36 int64_t number_of_bytes, | 37 int64_t number_of_bytes, |
37 PP_Time expected_last_modified_time) | 38 PP_Time expected_last_modified_time) |
38 : is_file(true), | 39 : is_file(true), |
39 file_ref(file_ref), | 40 file_ref_pp_resource(file_ref->pp_resource()), |
40 file_ref_host_resource(file_ref->host_resource()), | |
41 start_offset(start_offset), | 41 start_offset(start_offset), |
42 number_of_bytes(number_of_bytes), | 42 number_of_bytes(number_of_bytes), |
43 expected_last_modified_time(expected_last_modified_time) { | 43 expected_last_modified_time(expected_last_modified_time) { |
| 44 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource( |
| 45 file_ref_pp_resource); |
| 46 } |
| 47 |
| 48 URLRequestInfoData::BodyItem::~BodyItem() { |
| 49 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource( |
| 50 file_ref_pp_resource); |
44 } | 51 } |
45 | 52 |
46 URLRequestInfoData::URLRequestInfoData() | 53 URLRequestInfoData::URLRequestInfoData() |
47 : url(), | 54 : url(), |
48 method(), | 55 method(), |
49 headers(), | 56 headers(), |
50 stream_to_file(false), | 57 stream_to_file(false), |
51 follow_redirects(true), | 58 follow_redirects(true), |
52 record_download_progress(false), | 59 record_download_progress(false), |
53 record_upload_progress(false), | 60 record_upload_progress(false), |
54 has_custom_referrer_url(false), | 61 has_custom_referrer_url(false), |
55 custom_referrer_url(), | 62 custom_referrer_url(), |
56 allow_cross_origin_requests(false), | 63 allow_cross_origin_requests(false), |
57 allow_credentials(false), | 64 allow_credentials(false), |
58 has_custom_content_transfer_encoding(false), | 65 has_custom_content_transfer_encoding(false), |
59 custom_content_transfer_encoding(), | 66 custom_content_transfer_encoding(), |
60 has_custom_user_agent(false), | 67 has_custom_user_agent(false), |
61 custom_user_agent(), | 68 custom_user_agent(), |
62 prefetch_buffer_upper_threshold(kDefaultPrefetchBufferUpperThreshold), | 69 prefetch_buffer_upper_threshold(kDefaultPrefetchBufferUpperThreshold), |
63 prefetch_buffer_lower_threshold(kDefaultPrefetchBufferLowerThreshold), | 70 prefetch_buffer_lower_threshold(kDefaultPrefetchBufferLowerThreshold), |
64 body() { | 71 body() { |
65 } | 72 } |
66 | 73 |
67 URLRequestInfoData::~URLRequestInfoData() { | 74 URLRequestInfoData::~URLRequestInfoData() { |
68 } | 75 } |
69 | 76 |
70 } // namespace ppapi | 77 } // namespace ppapi |
OLD | NEW |