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/message_loop/message_loop_proxy.h" | 7 #include "base/message_loop/message_loop_proxy.h" |
Lei Zhang
2015/04/28 05:24:56
remove?
Pranay
2015/05/04 03:32:25
Done.
| |
8 #include "base/single_thread_task_runner.h" | |
Lei Zhang
2015/04/28 05:24:56
not needed?
Pranay
2015/05/04 03:32:25
Done.
| |
9 #include "base/thread_task_runner_handle.h" | |
8 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" | 10 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" |
9 #include "content/public/utility/utility_thread.h" | 11 #include "content/public/utility/utility_thread.h" |
10 | 12 |
11 namespace metadata { | 13 namespace metadata { |
12 | 14 |
13 IPCDataSource::IPCDataSource(int64 total_size) | 15 IPCDataSource::IPCDataSource(int64 total_size) |
14 : total_size_(total_size), | 16 : total_size_(total_size), |
15 utility_task_runner_(base::MessageLoopProxy::current()), | 17 utility_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
16 next_request_id_(0) { | 18 next_request_id_(0) { |
17 data_source_thread_checker_.DetachFromThread(); | 19 data_source_thread_checker_.DetachFromThread(); |
18 } | 20 } |
19 | 21 |
20 IPCDataSource::~IPCDataSource() { | 22 IPCDataSource::~IPCDataSource() { |
21 DCHECK(utility_thread_checker_.CalledOnValidThread()); | 23 DCHECK(utility_thread_checker_.CalledOnValidThread()); |
22 } | 24 } |
23 | 25 |
24 void IPCDataSource::Stop() { | 26 void IPCDataSource::Stop() { |
25 DCHECK(data_source_thread_checker_.CalledOnValidThread()); | 27 DCHECK(data_source_thread_checker_.CalledOnValidThread()); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 if (it == pending_requests_.end()) | 100 if (it == pending_requests_.end()) |
99 return; | 101 return; |
100 | 102 |
101 std::copy(bytes.begin(), bytes.end(), it->second.destination); | 103 std::copy(bytes.begin(), bytes.end(), it->second.destination); |
102 it->second.callback.Run(bytes.size()); | 104 it->second.callback.Run(bytes.size()); |
103 | 105 |
104 pending_requests_.erase(it); | 106 pending_requests_.erase(it); |
105 } | 107 } |
106 | 108 |
107 } // namespace metadata | 109 } // namespace metadata |
OLD | NEW |