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

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

Issue 2584233002: Specify TaskType of posted Task explicitly in FileAPIs (4) (Closed)
Patch Set: Created 4 years 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 19 matching lines...) Expand all
30 30
31 #include "core/fileapi/FileReader.h" 31 #include "core/fileapi/FileReader.h"
32 32
33 #include "bindings/core/v8/ExceptionState.h" 33 #include "bindings/core/v8/ExceptionState.h"
34 #include "bindings/core/v8/StringOrArrayBuffer.h" 34 #include "bindings/core/v8/StringOrArrayBuffer.h"
35 #include "core/dom/DOMArrayBuffer.h" 35 #include "core/dom/DOMArrayBuffer.h"
36 #include "core/dom/Document.h" 36 #include "core/dom/Document.h"
37 #include "core/dom/ExceptionCode.h" 37 #include "core/dom/ExceptionCode.h"
38 #include "core/dom/ExecutionContext.h" 38 #include "core/dom/ExecutionContext.h"
39 #include "core/dom/ExecutionContextTask.h" 39 #include "core/dom/ExecutionContextTask.h"
40 #include "core/dom/TaskRunnerHelper.h"
40 #include "core/events/ProgressEvent.h" 41 #include "core/events/ProgressEvent.h"
41 #include "core/fileapi/File.h" 42 #include "core/fileapi/File.h"
42 #include "core/inspector/InspectorInstrumentation.h" 43 #include "core/inspector/InspectorInstrumentation.h"
43 #include "platform/Supplementable.h" 44 #include "platform/Supplementable.h"
44 #include "wtf/AutoReset.h" 45 #include "wtf/AutoReset.h"
45 #include "wtf/CurrentTime.h" 46 #include "wtf/CurrentTime.h"
46 #include "wtf/Deque.h" 47 #include "wtf/Deque.h"
47 #include "wtf/HashSet.h" 48 #include "wtf/HashSet.h"
48 #include "wtf/text/CString.h" 49 #include "wtf/text/CString.h"
49 50
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 fireEvent(EventTypeNames::loadend); 349 fireEvent(EventTypeNames::loadend);
349 350
350 // All possible events have fired and we're done, no more pending activity. 351 // All possible events have fired and we're done, no more pending activity.
351 ThrottlingController::finishReader(getExecutionContext(), this, finalStep); 352 ThrottlingController::finishReader(getExecutionContext(), this, finalStep);
352 353
353 // ..but perform the loader cancellation asynchronously as abort() could be 354 // ..but perform the loader cancellation asynchronously as abort() could be
354 // called from the event handler and we do not want the resource loading code 355 // called from the event handler and we do not want the resource loading code
355 // to be on the stack when doing so. The persistent reference keeps the 356 // to be on the stack when doing so. The persistent reference keeps the
356 // reader alive until the task has completed. 357 // reader alive until the task has completed.
357 getExecutionContext()->postTask( 358 getExecutionContext()->postTask(
358 BLINK_FROM_HERE, 359 TaskType::FileReading, BLINK_FROM_HERE,
359 createSameThreadTask(&FileReader::terminate, wrapPersistent(this))); 360 createSameThreadTask(&FileReader::terminate, wrapPersistent(this)));
360 } 361 }
361 362
362 void FileReader::result(StringOrArrayBuffer& resultAttribute) const { 363 void FileReader::result(StringOrArrayBuffer& resultAttribute) const {
363 if (m_error || !m_loader) 364 if (m_error || !m_loader)
364 return; 365 return;
365 366
366 if (m_readType == FileReaderLoader::ReadAsArrayBuffer) 367 if (m_readType == FileReaderLoader::ReadAsArrayBuffer)
367 resultAttribute.setArrayBuffer(m_loader->arrayBufferResult()); 368 resultAttribute.setArrayBuffer(m_loader->arrayBufferResult());
368 else 369 else
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 ProgressEvent::create(type, false, m_loader->bytesLoaded(), 0)); 470 ProgressEvent::create(type, false, m_loader->bytesLoaded(), 0));
470 } 471 }
471 472
472 DEFINE_TRACE(FileReader) { 473 DEFINE_TRACE(FileReader) {
473 visitor->trace(m_error); 474 visitor->trace(m_error);
474 EventTargetWithInlineData::trace(visitor); 475 EventTargetWithInlineData::trace(visitor);
475 SuspendableObject::trace(visitor); 476 SuspendableObject::trace(visitor);
476 } 477 }
477 478
478 } // namespace blink 479 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp ('k') | third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698