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

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

Issue 2394653003: reflow comments in core/events,core/fileapi (Closed)
Patch Set: Created 4 years, 2 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 ASSERT(blob); 260 ASSERT(blob);
261 DVLOG(1) << "reading as data URL: " << utf8BlobUUID(blob).data() << " " 261 DVLOG(1) << "reading as data URL: " << utf8BlobUUID(blob).data() << " "
262 << utf8FilePath(blob).data(); 262 << utf8FilePath(blob).data();
263 263
264 readInternal(blob, FileReaderLoader::ReadAsDataURL, exceptionState); 264 readInternal(blob, FileReaderLoader::ReadAsDataURL, exceptionState);
265 } 265 }
266 266
267 void FileReader::readInternal(Blob* blob, 267 void FileReader::readInternal(Blob* blob,
268 FileReaderLoader::ReadType type, 268 FileReaderLoader::ReadType type,
269 ExceptionState& exceptionState) { 269 ExceptionState& exceptionState) {
270 // If multiple concurrent read methods are called on the same FileReader, Inva lidStateError should be thrown when the state is kLoading. 270 // If multiple concurrent read methods are called on the same FileReader,
271 // InvalidStateError should be thrown when the state is kLoading.
271 if (m_state == kLoading) { 272 if (m_state == kLoading) {
272 exceptionState.throwDOMException( 273 exceptionState.throwDOMException(
273 InvalidStateError, "The object is already busy reading Blobs."); 274 InvalidStateError, "The object is already busy reading Blobs.");
274 return; 275 return;
275 } 276 }
276 277
277 if (blob->isClosed()) { 278 if (blob->isClosed()) {
278 exceptionState.throwDOMException( 279 exceptionState.throwDOMException(
279 InvalidStateError, 280 InvalidStateError,
280 String(blob->isFile() ? "File" : "Blob") + " has been closed."); 281 String(blob->isFile() ? "File" : "Blob") + " has been closed.");
281 return; 282 return;
282 } 283 }
283 284
284 ExecutionContext* context = getExecutionContext(); 285 ExecutionContext* context = getExecutionContext();
285 if (!context) { 286 if (!context) {
286 exceptionState.throwDOMException( 287 exceptionState.throwDOMException(
287 AbortError, "Reading from a detached FileReader is not supported."); 288 AbortError, "Reading from a detached FileReader is not supported.");
288 return; 289 return;
289 } 290 }
290 291
291 // A document loader will not load new resources once the Document has detache d from its frame. 292 // A document loader will not load new resources once the Document has
293 // detached from its frame.
292 if (context->isDocument() && !toDocument(context)->frame()) { 294 if (context->isDocument() && !toDocument(context)->frame()) {
293 exceptionState.throwDOMException( 295 exceptionState.throwDOMException(
294 AbortError, 296 AbortError,
295 "Reading from a Document-detached FileReader is not supported."); 297 "Reading from a Document-detached FileReader is not supported.");
296 return; 298 return;
297 } 299 }
298 300
299 // "Snapshot" the Blob data rather than the Blob itself as ongoing 301 // "Snapshot" the Blob data rather than the Blob itself as ongoing
300 // read operations should not be affected if close() is called on 302 // read operations should not be affected if close() is called on
301 // the Blob being read. 303 // the Blob being read.
(...skipping 24 matching lines...) Expand all
326 328
327 void FileReader::abort() { 329 void FileReader::abort() {
328 DVLOG(1) << "aborting"; 330 DVLOG(1) << "aborting";
329 331
330 if (m_loadingState != LoadingStateLoading && 332 if (m_loadingState != LoadingStateLoading &&
331 m_loadingState != LoadingStatePending) { 333 m_loadingState != LoadingStatePending) {
332 return; 334 return;
333 } 335 }
334 m_loadingState = LoadingStateAborted; 336 m_loadingState = LoadingStateAborted;
335 337
336 // Schedule to have the abort done later since abort() might be called from th e event handler and we do not want the resource loading code to be in the stack. 338 // Schedule to have the abort done later since abort() might be called from
339 // the event handler and we do not want the resource loading code to be in the
340 // stack.
337 getExecutionContext()->postTask( 341 getExecutionContext()->postTask(
338 BLINK_FROM_HERE, 342 BLINK_FROM_HERE,
339 createSameThreadTask(&delayedAbort, wrapPersistent(this))); 343 createSameThreadTask(&delayedAbort, wrapPersistent(this)));
340 } 344 }
341 345
342 void FileReader::doAbort() { 346 void FileReader::doAbort() {
343 DCHECK_NE(kDone, m_state); 347 DCHECK_NE(kDone, m_state);
344 AutoReset<bool> firingEvents(&m_stillFiringEvents, true); 348 AutoReset<bool> firingEvents(&m_stillFiringEvents, true);
345 349
346 terminate(); 350 terminate();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 ProgressEvent::create(type, false, m_loader->bytesLoaded(), 0)); 474 ProgressEvent::create(type, false, m_loader->bytesLoaded(), 0));
471 } 475 }
472 476
473 DEFINE_TRACE(FileReader) { 477 DEFINE_TRACE(FileReader) {
474 visitor->trace(m_error); 478 visitor->trace(m_error);
475 EventTargetWithInlineData::trace(visitor); 479 EventTargetWithInlineData::trace(visitor);
476 ActiveDOMObject::trace(visitor); 480 ActiveDOMObject::trace(visitor);
477 } 481 }
478 482
479 } // namespace blink 483 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fileapi/FileError.cpp ('k') | third_party/WebKit/Source/core/fileapi/FileReaderLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698