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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 if (!ParseURL(request_->url(), &text, &count)) | 486 if (!ParseURL(request_->url(), &text, &count)) |
487 return net::ERR_INVALID_URL; | 487 return net::ERR_INVALID_URL; |
488 | 488 |
489 data->reserve(text.size() * count); | 489 data->reserve(text.size() * count); |
490 for (int i = 0; i < count; ++i) | 490 for (int i = 0; i < count; ++i) |
491 data->append(text); | 491 data->append(text); |
492 | 492 |
493 return net::OK; | 493 return net::OK; |
494 } | 494 } |
495 | 495 |
496 base::TaskRunner* GetTaskRunner() const override { | |
497 return base::ThreadTaskRunnerHandle::Get().get(); | |
498 } | |
499 | |
500 private: | 496 private: |
501 ~URLRequestBigJob() override {} | 497 ~URLRequestBigJob() override {} |
502 | 498 |
503 // big-job:substring,N | 499 // big-job:substring,N |
504 static bool ParseURL(const GURL& url, std::string* text, int* count) { | 500 static bool ParseURL(const GURL& url, std::string* text, int* count) { |
505 std::vector<std::string> parts = base::SplitString( | 501 std::vector<std::string> parts = base::SplitString( |
506 url.path(), ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 502 url.path(), ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
507 | 503 |
508 if (parts.size() != 2) | 504 if (parts.size() != 2) |
509 return false; | 505 return false; |
(...skipping 3485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3995 return nullptr; | 3991 return nullptr; |
3996 } | 3992 } |
3997 | 3993 |
3998 INSTANTIATE_TEST_CASE_P( | 3994 INSTANTIATE_TEST_CASE_P( |
3999 ResourceDispatcherHostTests, | 3995 ResourceDispatcherHostTests, |
4000 ResourceDispatcherHostTest, | 3996 ResourceDispatcherHostTest, |
4001 testing::Values(TestConfig::kDefault, | 3997 testing::Values(TestConfig::kDefault, |
4002 TestConfig::kOptimizeIPCForSmallResourceEnabled)); | 3998 TestConfig::kOptimizeIPCForSmallResourceEnabled)); |
4003 | 3999 |
4004 } // namespace content | 4000 } // namespace content |
OLD | NEW |