Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/child/blob_storage/blob_transport_controller.h" | 5 #include "content/child/blob_storage/blob_transport_controller.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 BlobTransportController::GetDescriptions( | 174 BlobTransportController::GetDescriptions( |
| 175 consolidation.get(), quotas.max_ipc_memory_size, &descriptions); | 175 consolidation.get(), quotas.max_ipc_memory_size, &descriptions); |
| 176 // I post the task first to make sure that we store our consolidation before | 176 // I post the task first to make sure that we store our consolidation before |
| 177 // we get a request back from the browser. | 177 // we get a request back from the browser. |
| 178 io_runner->PostTask( | 178 io_runner->PostTask( |
| 179 FROM_HERE, | 179 FROM_HERE, |
| 180 base::Bind(&BlobTransportController::StoreBlobDataForRequests, | 180 base::Bind(&BlobTransportController::StoreBlobDataForRequests, |
| 181 base::Unretained(BlobTransportController::GetInstance()), uuid, | 181 base::Unretained(BlobTransportController::GetInstance()), uuid, |
| 182 base::Passed(std::move(consolidation)), | 182 base::Passed(std::move(consolidation)), |
| 183 base::Passed(std::move(main_runner)))); | 183 base::Passed(std::move(main_runner)))); |
| 184 | |
| 185 // Measure how much jank this synchronous IPC is introducing. | |
| 186 base::TimeTicks time_before = base::TimeTicks::Now(); | |
|
Alexei Svitkine (slow)
2017/02/08 19:29:29
Nit: You can make this a bit simpler by using SCOP
| |
| 187 | |
| 184 sender->Send( | 188 sender->Send( |
| 185 new BlobStorageMsg_RegisterBlob(uuid, content_type, "", descriptions)); | 189 new BlobStorageMsg_RegisterBlob(uuid, content_type, "", descriptions)); |
| 190 | |
| 191 base::TimeDelta time_delta = base::TimeTicks::Now() - time_before; | |
| 192 UMA_HISTOGRAM_TIMES("Storage.Blob.RegisterBlobTime", time_delta); | |
| 186 } | 193 } |
| 187 | 194 |
| 188 void BlobTransportController::OnMemoryRequest( | 195 void BlobTransportController::OnMemoryRequest( |
| 189 const std::string& uuid, | 196 const std::string& uuid, |
| 190 const std::vector<storage::BlobItemBytesRequest>& requests, | 197 const std::vector<storage::BlobItemBytesRequest>& requests, |
| 191 std::vector<base::SharedMemoryHandle>* memory_handles, | 198 std::vector<base::SharedMemoryHandle>* memory_handles, |
| 192 const std::vector<IPC::PlatformFileForTransit>& file_handles, | 199 const std::vector<IPC::PlatformFileForTransit>& file_handles, |
| 193 base::TaskRunner* file_runner, | 200 base::TaskRunner* file_runner, |
| 194 IPC::Sender* sender) { | 201 IPC::Sender* sender) { |
| 195 std::vector<BlobItemBytesResponse> responses; | 202 std::vector<BlobItemBytesResponse> responses; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 | 413 |
| 407 void BlobTransportController::ReleaseBlobConsolidation( | 414 void BlobTransportController::ReleaseBlobConsolidation( |
| 408 const std::string& uuid) { | 415 const std::string& uuid) { |
| 409 if (blob_storage_.erase(uuid)) { | 416 if (blob_storage_.erase(uuid)) { |
| 410 main_thread_runner_->PostTask(FROM_HERE, | 417 main_thread_runner_->PostTask(FROM_HERE, |
| 411 base::Bind(&DecChildProcessRefCount)); | 418 base::Bind(&DecChildProcessRefCount)); |
| 412 } | 419 } |
| 413 } | 420 } |
| 414 | 421 |
| 415 } // namespace content | 422 } // namespace content |
| OLD | NEW |