Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: third_party/WebKit/Source/core/fileapi/FileReaderLoader.cpp

Issue 2282413002: Replaced PassRefPtr copies with moves in Source/core. (Closed)
Patch Set: rebased Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 { 85 {
86 // The blob is read by routing through the request handling layer given a te mporary public url. 86 // The blob is read by routing through the request handling layer given a te mporary public url.
87 m_urlForReading = BlobURL::createPublicURL(executionContext.getSecurityOrigi n()); 87 m_urlForReading = BlobURL::createPublicURL(executionContext.getSecurityOrigi n());
88 if (m_urlForReading.isEmpty()) { 88 if (m_urlForReading.isEmpty()) {
89 failed(FileError::kSecurityErr); 89 failed(FileError::kSecurityErr);
90 return; 90 return;
91 } 91 }
92 92
93 if (blobData) { 93 if (blobData) {
94 ASSERT(!stream); 94 ASSERT(!stream);
95 BlobRegistry::registerPublicBlobURL(executionContext.getSecurityOrigin() , m_urlForReading, blobData); 95 BlobRegistry::registerPublicBlobURL(executionContext.getSecurityOrigin() , m_urlForReading, std::move(blobData));
96 } else { 96 } else {
97 ASSERT(stream); 97 ASSERT(stream);
98 BlobRegistry::registerStreamURL(executionContext.getSecurityOrigin(), m_ urlForReading, stream->url()); 98 BlobRegistry::registerStreamURL(executionContext.getSecurityOrigin(), m_ urlForReading, stream->url());
99 } 99 }
100 100
101 // Construct and load the request. 101 // Construct and load the request.
102 ResourceRequest request(m_urlForReading); 102 ResourceRequest request(m_urlForReading);
103 request.setExternalRequestStateFromRequestorAddressSpace(executionContext.se curityContext().addressSpace()); 103 request.setExternalRequestStateFromRequestorAddressSpace(executionContext.se curityContext().addressSpace());
104 104
105 // FIXME: Should this really be 'internal'? Do we know anything about the ac tual request that generated this fetch? 105 // FIXME: Should this really be 'internal'? Do we know anything about the ac tual request that generated this fetch?
(...skipping 19 matching lines...) Expand all
125 m_loader->start(request); 125 m_loader->start(request);
126 } else { 126 } else {
127 ThreadableLoader::loadResourceSynchronously(executionContext, request, * this, options, resourceLoaderOptions); 127 ThreadableLoader::loadResourceSynchronously(executionContext, request, * this, options, resourceLoaderOptions);
128 } 128 }
129 } 129 }
130 130
131 void FileReaderLoader::start(ExecutionContext* executionContext, PassRefPtr<Blob DataHandle> blobData) 131 void FileReaderLoader::start(ExecutionContext* executionContext, PassRefPtr<Blob DataHandle> blobData)
132 { 132 {
133 ASSERT(executionContext); 133 ASSERT(executionContext);
134 m_urlForReadingIsStream = false; 134 m_urlForReadingIsStream = false;
135 startInternal(*executionContext, 0, blobData); 135 startInternal(*executionContext, 0, std::move(blobData));
136 } 136 }
137 137
138 void FileReaderLoader::start(ExecutionContext* executionContext, const Stream& s tream, unsigned readSize) 138 void FileReaderLoader::start(ExecutionContext* executionContext, const Stream& s tream, unsigned readSize)
139 { 139 {
140 ASSERT(executionContext); 140 ASSERT(executionContext);
141 if (readSize > 0) { 141 if (readSize > 0) {
142 m_hasRange = true; 142 m_hasRange = true;
143 m_rangeStart = 0; 143 m_rangeStart = 0;
144 m_rangeEnd = readSize - 1; // End is inclusive so (0,0) is a 1-byte read . 144 m_rangeEnd = readSize - 1; // End is inclusive so (0,0) is a 1-byte read .
145 } 145 }
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 m_stringResult = builder.toString(); 408 m_stringResult = builder.toString();
409 } 409 }
410 410
411 void FileReaderLoader::setEncoding(const String& encoding) 411 void FileReaderLoader::setEncoding(const String& encoding)
412 { 412 {
413 if (!encoding.isEmpty()) 413 if (!encoding.isEmpty())
414 m_encoding = WTF::TextEncoding(encoding); 414 m_encoding = WTF::TextEncoding(encoding);
415 } 415 }
416 416
417 } // namespace blink 417 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fileapi/File.cpp ('k') | third_party/WebKit/Source/core/frame/DOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698