OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/webblobregistry_impl.h" | 5 #include "content/child/webblobregistry_impl.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/guid.h" | 8 #include "base/guid.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/numerics/safe_conversions.h" | 13 #include "base/numerics/safe_conversions.h" |
14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
15 #include "content/child/child_thread_impl.h" | 15 #include "content/child/child_thread_impl.h" |
16 #include "content/child/thread_safe_sender.h" | 16 #include "content/child/thread_safe_sender.h" |
17 #include "content/common/fileapi/webblob_messages.h" | 17 #include "content/common/fileapi/webblob_messages.h" |
| 18 #include "third_party/WebKit/public/platform/FilePathConversion.h" |
18 #include "third_party/WebKit/public/platform/WebBlobData.h" | 19 #include "third_party/WebKit/public/platform/WebBlobData.h" |
19 #include "third_party/WebKit/public/platform/WebString.h" | 20 #include "third_party/WebKit/public/platform/WebString.h" |
20 #include "third_party/WebKit/public/platform/WebThreadSafeData.h" | 21 #include "third_party/WebKit/public/platform/WebThreadSafeData.h" |
21 #include "third_party/WebKit/public/platform/WebURL.h" | 22 #include "third_party/WebKit/public/platform/WebURL.h" |
22 | 23 |
23 using blink::WebBlobData; | 24 using blink::WebBlobData; |
24 using blink::WebString; | 25 using blink::WebString; |
25 using blink::WebThreadSafeData; | 26 using blink::WebThreadSafeData; |
26 using blink::WebURL; | 27 using blink::WebURL; |
27 using blink::WebBlobRegistry; | 28 using blink::WebBlobRegistry; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 uint64_t length) { | 204 uint64_t length) { |
204 consolidation_.AddBlobItem(uuid.utf8(), offset, length); | 205 consolidation_.AddBlobItem(uuid.utf8(), offset, length); |
205 } | 206 } |
206 | 207 |
207 void WebBlobRegistryImpl::BuilderImpl::appendFile( | 208 void WebBlobRegistryImpl::BuilderImpl::appendFile( |
208 const WebString& path, | 209 const WebString& path, |
209 uint64_t offset, | 210 uint64_t offset, |
210 uint64_t length, | 211 uint64_t length, |
211 double expected_modification_time) { | 212 double expected_modification_time) { |
212 consolidation_.AddFileItem( | 213 consolidation_.AddFileItem( |
213 base::FilePath::FromUTF16Unsafe(base::string16(path)), offset, length, | 214 blink::WebStringToFilePath(path), offset, length, |
214 expected_modification_time); | 215 expected_modification_time); |
215 } | 216 } |
216 | 217 |
217 void WebBlobRegistryImpl::BuilderImpl::appendFileSystemURL( | 218 void WebBlobRegistryImpl::BuilderImpl::appendFileSystemURL( |
218 const WebURL& fileSystemURL, | 219 const WebURL& fileSystemURL, |
219 uint64_t offset, | 220 uint64_t offset, |
220 uint64_t length, | 221 uint64_t length, |
221 double expected_modification_time) { | 222 double expected_modification_time) { |
222 DCHECK(GURL(fileSystemURL).SchemeIsFileSystem()); | 223 DCHECK(GURL(fileSystemURL).SchemeIsFileSystem()); |
223 consolidation_.AddFileSystemItem(GURL(fileSystemURL), offset, length, | 224 consolidation_.AddFileSystemItem(GURL(fileSystemURL), offset, length, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 consolidation_.ReadMemory(consolidated_item_index, offset, chunk_size, | 303 consolidation_.ReadMemory(consolidated_item_index, offset, chunk_size, |
303 shared_memory->memory()); | 304 shared_memory->memory()); |
304 sender_->Send(new BlobHostMsg_SyncAppendSharedMemory( | 305 sender_->Send(new BlobHostMsg_SyncAppendSharedMemory( |
305 uuid_, shared_memory->handle(), static_cast<uint32_t>(chunk_size))); | 306 uuid_, shared_memory->handle(), static_cast<uint32_t>(chunk_size))); |
306 data_size -= chunk_size; | 307 data_size -= chunk_size; |
307 offset += chunk_size; | 308 offset += chunk_size; |
308 } | 309 } |
309 } | 310 } |
310 | 311 |
311 } // namespace content | 312 } // namespace content |
OLD | NEW |