| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 2563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2574 ASSERT_NE(storage::BlobReader::Status::NET_ERROR, status); | 2574 ASSERT_NE(storage::BlobReader::Status::NET_ERROR, status); |
| 2575 if (status == storage::BlobReader::Status::DONE) | 2575 if (status == storage::BlobReader::Status::DONE) |
| 2576 OnBlobReaderCalculateSizeCallback(result, continuation, net::OK); | 2576 OnBlobReaderCalculateSizeCallback(result, continuation, net::OK); |
| 2577 } | 2577 } |
| 2578 | 2578 |
| 2579 void OnBlobReaderCalculateSizeCallback(int* result, | 2579 void OnBlobReaderCalculateSizeCallback(int* result, |
| 2580 const base::Closure& continuation, | 2580 const base::Closure& continuation, |
| 2581 int size_result) { | 2581 int size_result) { |
| 2582 ASSERT_EQ(net::OK, size_result); | 2582 ASSERT_EQ(net::OK, size_result); |
| 2583 if (!blob_reader_->has_side_data()) { | 2583 if (!blob_reader_->has_side_data()) { |
| 2584 blob_reader_ = nullptr; |
| 2584 continuation.Run(); | 2585 continuation.Run(); |
| 2585 return; | 2586 return; |
| 2586 } | 2587 } |
| 2587 const storage::BlobReader::Status status = blob_reader_->ReadSideData( | 2588 const storage::BlobReader::Status status = blob_reader_->ReadSideData( |
| 2588 base::Bind(&self::OnBlobReaderReadSideDataCallback, this, result, | 2589 base::Bind(&self::OnBlobReaderReadSideDataCallback, this, result, |
| 2589 continuation)); | 2590 continuation)); |
| 2590 ASSERT_NE(storage::BlobReader::Status::NET_ERROR, status); | 2591 ASSERT_NE(storage::BlobReader::Status::NET_ERROR, status); |
| 2591 if (status == storage::BlobReader::Status::DONE) { | 2592 if (status == storage::BlobReader::Status::DONE) { |
| 2592 OnBlobReaderReadSideDataCallback(result, continuation, | 2593 OnBlobReaderReadSideDataCallback(result, continuation, |
| 2593 storage::BlobReader::Status::DONE); | 2594 storage::BlobReader::Status::DONE); |
| 2594 } | 2595 } |
| 2595 } | 2596 } |
| 2596 | 2597 |
| 2597 void OnBlobReaderReadSideDataCallback(int* result, | 2598 void OnBlobReaderReadSideDataCallback(int* result, |
| 2598 const base::Closure& continuation, | 2599 const base::Closure& continuation, |
| 2599 storage::BlobReader::Status status) { | 2600 storage::BlobReader::Status status) { |
| 2600 ASSERT_NE(storage::BlobReader::Status::NET_ERROR, status); | 2601 ASSERT_NE(storage::BlobReader::Status::NET_ERROR, status); |
| 2601 *result = blob_reader_->side_data()->size(); | 2602 *result = blob_reader_->side_data()->size(); |
| 2603 blob_reader_ = nullptr; |
| 2602 continuation.Run(); | 2604 continuation.Run(); |
| 2603 } | 2605 } |
| 2604 | 2606 |
| 2605 CacheStorageContextImpl* cache_storage_context_; | 2607 CacheStorageContextImpl* cache_storage_context_; |
| 2606 storage::FileSystemContext* file_system_context_; | 2608 storage::FileSystemContext* file_system_context_; |
| 2607 const GURL origin_; | 2609 const GURL origin_; |
| 2608 const std::string cache_name_; | 2610 const std::string cache_name_; |
| 2609 const GURL url_; | 2611 const GURL url_; |
| 2610 std::unique_ptr<storage::BlobDataHandle> blob_data_handle_; | 2612 std::unique_ptr<storage::BlobDataHandle> blob_data_handle_; |
| 2611 std::unique_ptr<storage::BlobReader> blob_reader_; | 2613 std::unique_ptr<storage::BlobReader> blob_reader_; |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2936 // effect in CanSuspendRenderer(). | 2938 // effect in CanSuspendRenderer(). |
| 2937 shell()->web_contents()->WasHidden(); | 2939 shell()->web_contents()->WasHidden(); |
| 2938 EXPECT_TRUE(rph->IsProcessBackgrounded()); | 2940 EXPECT_TRUE(rph->IsProcessBackgrounded()); |
| 2939 | 2941 |
| 2940 // The process which has service worker thread shouldn't be suspended. | 2942 // The process which has service worker thread shouldn't be suspended. |
| 2941 EXPECT_FALSE(memory_coordinator->CanSuspendRenderer(render_process_id)); | 2943 EXPECT_FALSE(memory_coordinator->CanSuspendRenderer(render_process_id)); |
| 2942 } | 2944 } |
| 2943 #endif | 2945 #endif |
| 2944 | 2946 |
| 2945 } // namespace content | 2947 } // namespace content |
| OLD | NEW |