| 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 "content/browser/loader/resource_loader.h" | 5 #include "content/browser/loader/resource_loader.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 class NonChunkedUploadDataStream : public net::UploadDataStream { | 490 class NonChunkedUploadDataStream : public net::UploadDataStream { |
| 491 public: | 491 public: |
| 492 explicit NonChunkedUploadDataStream(uint64_t size) | 492 explicit NonChunkedUploadDataStream(uint64_t size) |
| 493 : net::UploadDataStream(false, 0), stream_(0), size_(size) {} | 493 : net::UploadDataStream(false, 0), stream_(0), size_(size) {} |
| 494 | 494 |
| 495 void AppendData(const char* data) { | 495 void AppendData(const char* data) { |
| 496 stream_.AppendData(data, strlen(data), false); | 496 stream_.AppendData(data, strlen(data), false); |
| 497 } | 497 } |
| 498 | 498 |
| 499 private: | 499 private: |
| 500 int InitInternal() override { | 500 int InitInternal(const net::BoundNetLog& net_log) override { |
| 501 SetSize(size_); | 501 SetSize(size_); |
| 502 stream_.Init(base::Bind(&NonChunkedUploadDataStream::OnInitCompleted, | 502 stream_.Init(base::Bind(&NonChunkedUploadDataStream::OnInitCompleted, |
| 503 base::Unretained(this))); | 503 base::Unretained(this)), |
| 504 net_log); |
| 504 return net::OK; | 505 return net::OK; |
| 505 } | 506 } |
| 506 | 507 |
| 507 int ReadInternal(net::IOBuffer* buf, int buf_len) override { | 508 int ReadInternal(net::IOBuffer* buf, int buf_len) override { |
| 508 return stream_.Read(buf, buf_len, | 509 return stream_.Read(buf, buf_len, |
| 509 base::Bind(&NonChunkedUploadDataStream::OnReadCompleted, | 510 base::Bind(&NonChunkedUploadDataStream::OnReadCompleted, |
| 510 base::Unretained(this))); | 511 base::Unretained(this))); |
| 511 } | 512 } |
| 512 | 513 |
| 513 void ResetInternal() override { stream_.Reset(); } | 514 void ResetInternal() override { stream_.Reset(); } |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 | 1240 |
| 1240 // Tests that the effective connection type is not set on non-main frame | 1241 // Tests that the effective connection type is not set on non-main frame |
| 1241 // requests. | 1242 // requests. |
| 1242 TEST_F(EffectiveConnectionTypeResourceLoaderTest, DoesNotBelongToMainFrame) { | 1243 TEST_F(EffectiveConnectionTypeResourceLoaderTest, DoesNotBelongToMainFrame) { |
| 1243 VerifyEffectiveConnectionType(RESOURCE_TYPE_OBJECT, false, | 1244 VerifyEffectiveConnectionType(RESOURCE_TYPE_OBJECT, false, |
| 1244 net::EFFECTIVE_CONNECTION_TYPE_3G, | 1245 net::EFFECTIVE_CONNECTION_TYPE_3G, |
| 1245 net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN); | 1246 net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN); |
| 1246 } | 1247 } |
| 1247 | 1248 |
| 1248 } // namespace content | 1249 } // namespace content |
| OLD | NEW |