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/browser/media_galleries/fileapi/safe_media_metadata_parser.h" | 5 #include "chrome/browser/media_galleries/fileapi/safe_media_metadata_parser.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
8 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
9 #include "chrome/browser/extensions/blob_reader.h" | 11 #include "chrome/browser/extensions/blob_reader.h" |
10 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" | 12 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" |
11 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
12 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
13 #include "content/public/browser/child_process_data.h" | 15 #include "content/public/browser/child_process_data.h" |
14 #include "content/public/browser/utility_process_host.h" | 16 #include "content/public/browser/utility_process_host.h" |
15 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
16 | 18 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 reader->SetByteRange(byte_start, length); | 114 reader->SetByteRange(byte_start, length); |
113 reader->Start(); | 115 reader->Start(); |
114 } | 116 } |
115 | 117 |
116 void SafeMediaMetadataParser::OnBlobReaderDoneOnUIThread( | 118 void SafeMediaMetadataParser::OnBlobReaderDoneOnUIThread( |
117 int64_t request_id, | 119 int64_t request_id, |
118 scoped_ptr<std::string> data, | 120 scoped_ptr<std::string> data, |
119 int64_t /* blob_total_size */) { | 121 int64_t /* blob_total_size */) { |
120 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 122 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
121 BrowserThread::PostTask( | 123 BrowserThread::PostTask( |
122 BrowserThread::IO, | 124 BrowserThread::IO, FROM_HERE, |
123 FROM_HERE, | |
124 base::Bind(&SafeMediaMetadataParser::FinishRequestBlobBytes, this, | 125 base::Bind(&SafeMediaMetadataParser::FinishRequestBlobBytes, this, |
125 request_id, base::Passed(data.Pass()))); | 126 request_id, base::Passed(std::move(data)))); |
126 } | 127 } |
127 | 128 |
128 void SafeMediaMetadataParser::FinishRequestBlobBytes( | 129 void SafeMediaMetadataParser::FinishRequestBlobBytes( |
129 int64_t request_id, | 130 int64_t request_id, |
130 scoped_ptr<std::string> data) { | 131 scoped_ptr<std::string> data) { |
131 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 132 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
132 if (!utility_process_host_.get()) | 133 if (!utility_process_host_.get()) |
133 return; | 134 return; |
134 utility_process_host_->Send(new ChromeUtilityMsg_RequestBlobBytes_Finished( | 135 utility_process_host_->Send(new ChromeUtilityMsg_RequestBlobBytes_Finished( |
135 request_id, *data)); | 136 request_id, *data)); |
(...skipping 20 matching lines...) Expand all Loading... |
156 OnParseMediaMetadataFinished) | 157 OnParseMediaMetadataFinished) |
157 IPC_MESSAGE_HANDLER( | 158 IPC_MESSAGE_HANDLER( |
158 ChromeUtilityHostMsg_RequestBlobBytes, | 159 ChromeUtilityHostMsg_RequestBlobBytes, |
159 OnUtilityProcessRequestBlobBytes) | 160 OnUtilityProcessRequestBlobBytes) |
160 IPC_MESSAGE_UNHANDLED(handled = false) | 161 IPC_MESSAGE_UNHANDLED(handled = false) |
161 IPC_END_MESSAGE_MAP() | 162 IPC_END_MESSAGE_MAP() |
162 return handled; | 163 return handled; |
163 } | 164 } |
164 | 165 |
165 } // namespace metadata | 166 } // namespace metadata |
OLD | NEW |