| OLD | NEW |
| 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 26 matching lines...) Expand all Loading... |
| 37 #include "public/platform/WebFileWriter.h" | 37 #include "public/platform/WebFileWriter.h" |
| 38 #include "public/platform/WebURL.h" | 38 #include "public/platform/WebURL.h" |
| 39 #include "wtf/CurrentTime.h" | 39 #include "wtf/CurrentTime.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 static const int kMaxRecursionDepth = 3; | 43 static const int kMaxRecursionDepth = 3; |
| 44 static const double progressNotificationIntervalMS = 50; | 44 static const double progressNotificationIntervalMS = 50; |
| 45 | 45 |
| 46 FileWriter* FileWriter::create(ExecutionContext* context) { | 46 FileWriter* FileWriter::create(ExecutionContext* context) { |
| 47 FileWriter* fileWriter = new FileWriter(context); | 47 return new FileWriter(context); |
| 48 fileWriter->suspendIfNeeded(); | |
| 49 return fileWriter; | |
| 50 } | 48 } |
| 51 | 49 |
| 52 FileWriter::FileWriter(ExecutionContext* context) | 50 FileWriter::FileWriter(ExecutionContext* context) |
| 53 : SuspendableObject(context), | 51 : ContextLifecycleObserver(context), |
| 54 m_readyState(kInit), | 52 m_readyState(kInit), |
| 55 m_operationInProgress(OperationNone), | 53 m_operationInProgress(OperationNone), |
| 56 m_queuedOperation(OperationNone), | 54 m_queuedOperation(OperationNone), |
| 57 m_bytesWritten(0), | 55 m_bytesWritten(0), |
| 58 m_bytesToWrite(0), | 56 m_bytesToWrite(0), |
| 59 m_truncateLength(-1), | 57 m_truncateLength(-1), |
| 60 m_numAborts(0), | 58 m_numAborts(0), |
| 61 m_recursionDepth(0), | 59 m_recursionDepth(0), |
| 62 m_lastProgressNotificationTimeMS(0) {} | 60 m_lastProgressNotificationTimeMS(0) {} |
| 63 | 61 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 ASSERT(errorCode); | 302 ASSERT(errorCode); |
| 305 FileError::throwDOMException(exceptionState, errorCode); | 303 FileError::throwDOMException(exceptionState, errorCode); |
| 306 m_error = FileError::createDOMException(errorCode); | 304 m_error = FileError::createDOMException(errorCode); |
| 307 } | 305 } |
| 308 | 306 |
| 309 DEFINE_TRACE(FileWriter) { | 307 DEFINE_TRACE(FileWriter) { |
| 310 visitor->trace(m_error); | 308 visitor->trace(m_error); |
| 311 visitor->trace(m_blobBeingWritten); | 309 visitor->trace(m_blobBeingWritten); |
| 312 EventTargetWithInlineData::trace(visitor); | 310 EventTargetWithInlineData::trace(visitor); |
| 313 FileWriterBase::trace(visitor); | 311 FileWriterBase::trace(visitor); |
| 314 SuspendableObject::trace(visitor); | 312 ContextLifecycleObserver::trace(visitor); |
| 315 } | 313 } |
| 316 | 314 |
| 317 } // namespace blink | 315 } // namespace blink |
| OLD | NEW |