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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 { | 242 { |
243 ASSERT(m_operationInProgress == OperationAbort); | 243 ASSERT(m_operationInProgress == OperationAbort); |
244 m_operationInProgress = OperationNone; | 244 m_operationInProgress = OperationNone; |
245 Operation operation = m_queuedOperation; | 245 Operation operation = m_queuedOperation; |
246 m_queuedOperation = OperationNone; | 246 m_queuedOperation = OperationNone; |
247 doOperation(operation); | 247 doOperation(operation); |
248 } | 248 } |
249 | 249 |
250 void FileWriter::doOperation(Operation operation) | 250 void FileWriter::doOperation(Operation operation) |
251 { | 251 { |
252 m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarting(e
xecutionContext(), "FileWriter", m_asyncOperationId); | 252 m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarting(g
etExecutionContext(), "FileWriter", m_asyncOperationId); |
253 switch (operation) { | 253 switch (operation) { |
254 case OperationWrite: | 254 case OperationWrite: |
255 ASSERT(m_operationInProgress == OperationNone); | 255 ASSERT(m_operationInProgress == OperationNone); |
256 ASSERT(m_truncateLength == -1); | 256 ASSERT(m_truncateLength == -1); |
257 ASSERT(m_blobBeingWritten.get()); | 257 ASSERT(m_blobBeingWritten.get()); |
258 ASSERT(m_readyState == WRITING); | 258 ASSERT(m_readyState == WRITING); |
259 writer()->write(position(), m_blobBeingWritten->uuid()); | 259 writer()->write(position(), m_blobBeingWritten->uuid()); |
260 break; | 260 break; |
261 case OperationTruncate: | 261 case OperationTruncate: |
262 ASSERT(m_operationInProgress == OperationNone); | 262 ASSERT(m_operationInProgress == OperationNone); |
(...skipping 28 matching lines...) Expand all Loading... |
291 if (FileError::OK != code) { | 291 if (FileError::OK != code) { |
292 m_error = FileError::create(code); | 292 m_error = FileError::create(code); |
293 if (FileError::ABORT_ERR == code) | 293 if (FileError::ABORT_ERR == code) |
294 fireEvent(EventTypeNames::abort); | 294 fireEvent(EventTypeNames::abort); |
295 else | 295 else |
296 fireEvent(EventTypeNames::error); | 296 fireEvent(EventTypeNames::error); |
297 } else | 297 } else |
298 fireEvent(EventTypeNames::write); | 298 fireEvent(EventTypeNames::write); |
299 fireEvent(EventTypeNames::writeend); | 299 fireEvent(EventTypeNames::writeend); |
300 | 300 |
301 InspectorInstrumentation::traceAsyncOperationCompleted(executionContext(), m
_asyncOperationId); | 301 InspectorInstrumentation::traceAsyncOperationCompleted(getExecutionContext()
, m_asyncOperationId); |
302 m_asyncOperationId = 0; | 302 m_asyncOperationId = 0; |
303 } | 303 } |
304 | 304 |
305 void FileWriter::fireEvent(const AtomicString& type) | 305 void FileWriter::fireEvent(const AtomicString& type) |
306 { | 306 { |
307 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(executionContext(), m_asyncOperationId); | 307 InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceAsync
CallbackStarting(getExecutionContext(), m_asyncOperationId); |
308 ++m_recursionDepth; | 308 ++m_recursionDepth; |
309 dispatchEvent(ProgressEvent::create(type, true, m_bytesWritten, m_bytesToWri
te)); | 309 dispatchEvent(ProgressEvent::create(type, true, m_bytesWritten, m_bytesToWri
te)); |
310 --m_recursionDepth; | 310 --m_recursionDepth; |
311 ASSERT(m_recursionDepth >= 0); | 311 ASSERT(m_recursionDepth >= 0); |
312 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 312 InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); |
313 } | 313 } |
314 | 314 |
315 void FileWriter::setError(FileError::ErrorCode errorCode, ExceptionState& except
ionState) | 315 void FileWriter::setError(FileError::ErrorCode errorCode, ExceptionState& except
ionState) |
316 { | 316 { |
317 ASSERT(errorCode); | 317 ASSERT(errorCode); |
318 FileError::throwDOMException(exceptionState, errorCode); | 318 FileError::throwDOMException(exceptionState, errorCode); |
319 m_error = FileError::create(errorCode); | 319 m_error = FileError::create(errorCode); |
320 } | 320 } |
321 | 321 |
322 DEFINE_TRACE(FileWriter) | 322 DEFINE_TRACE(FileWriter) |
323 { | 323 { |
324 visitor->trace(m_error); | 324 visitor->trace(m_error); |
325 visitor->trace(m_blobBeingWritten); | 325 visitor->trace(m_blobBeingWritten); |
326 EventTargetWithInlineData::trace(visitor); | 326 EventTargetWithInlineData::trace(visitor); |
327 FileWriterBase::trace(visitor); | 327 FileWriterBase::trace(visitor); |
328 ActiveDOMObject::trace(visitor); | 328 ActiveDOMObject::trace(visitor); |
329 } | 329 } |
330 | 330 |
331 } // namespace blink | 331 } // namespace blink |
OLD | NEW |