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 "chrome/utility/media_galleries/ipc_data_source.h" | 5 #include "chrome/utility/media_galleries/ipc_data_source.h" |
6 | 6 |
7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
8 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" | 8 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" |
9 #include "content/public/utility/utility_thread.h" | 9 #include "content/public/utility/utility_thread.h" |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 OnRequestBlobBytesFinished) | 59 OnRequestBlobBytesFinished) |
60 IPC_MESSAGE_UNHANDLED(handled = false) | 60 IPC_MESSAGE_UNHANDLED(handled = false) |
61 IPC_END_MESSAGE_MAP() | 61 IPC_END_MESSAGE_MAP() |
62 return handled; | 62 return handled; |
63 } | 63 } |
64 | 64 |
65 IPCDataSource::Request::Request() | 65 IPCDataSource::Request::Request() |
66 : destination(NULL) { | 66 : destination(NULL) { |
67 } | 67 } |
68 | 68 |
| 69 IPCDataSource::Request::Request(const Request& other) = default; |
| 70 |
69 IPCDataSource::Request::~Request() { | 71 IPCDataSource::Request::~Request() { |
70 } | 72 } |
71 | 73 |
72 void IPCDataSource::ReadOnUtilityThread(int64_t position, | 74 void IPCDataSource::ReadOnUtilityThread(int64_t position, |
73 int size, | 75 int size, |
74 uint8_t* data, | 76 uint8_t* data, |
75 const DataSource::ReadCB& read_cb) { | 77 const DataSource::ReadCB& read_cb) { |
76 DCHECK(utility_thread_checker_.CalledOnValidThread()); | 78 DCHECK(utility_thread_checker_.CalledOnValidThread()); |
77 CHECK_GE(total_size_, 0); | 79 CHECK_GE(total_size_, 0); |
78 CHECK_GE(position, 0); | 80 CHECK_GE(position, 0); |
(...skipping 23 matching lines...) Expand all Loading... |
102 if (it == pending_requests_.end()) | 104 if (it == pending_requests_.end()) |
103 return; | 105 return; |
104 | 106 |
105 std::copy(bytes.begin(), bytes.end(), it->second.destination); | 107 std::copy(bytes.begin(), bytes.end(), it->second.destination); |
106 it->second.callback.Run(bytes.size()); | 108 it->second.callback.Run(bytes.size()); |
107 | 109 |
108 pending_requests_.erase(it); | 110 pending_requests_.erase(it); |
109 } | 111 } |
110 | 112 |
111 } // namespace metadata | 113 } // namespace metadata |
OLD | NEW |