OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "core/events/ThreadLocalEventNames.h" | 30 #include "core/events/ThreadLocalEventNames.h" |
31 #include "core/xml/XMLHttpRequest.h" | 31 #include "core/xml/XMLHttpRequest.h" |
32 #include "core/xml/XMLHttpRequestProgressEvent.h" | 32 #include "core/xml/XMLHttpRequestProgressEvent.h" |
33 #include "wtf/Assertions.h" | 33 #include "wtf/Assertions.h" |
34 #include "wtf/text/AtomicString.h" | 34 #include "wtf/text/AtomicString.h" |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 XMLHttpRequestUpload::XMLHttpRequestUpload(XMLHttpRequest* xmlHttpRequest) | 38 XMLHttpRequestUpload::XMLHttpRequestUpload(XMLHttpRequest* xmlHttpRequest) |
39 : m_xmlHttpRequest(xmlHttpRequest) | 39 : m_xmlHttpRequest(xmlHttpRequest) |
| 40 , m_lastBytesSent(0) |
| 41 , m_lastTotalBytesToBeSent(0) |
40 { | 42 { |
41 ScriptWrappable::init(this); | 43 ScriptWrappable::init(this); |
42 } | 44 } |
43 | 45 |
44 const AtomicString& XMLHttpRequestUpload::interfaceName() const | 46 const AtomicString& XMLHttpRequestUpload::interfaceName() const |
45 { | 47 { |
46 return EventTargetNames::XMLHttpRequestUpload; | 48 return EventTargetNames::XMLHttpRequestUpload; |
47 } | 49 } |
48 | 50 |
49 ExecutionContext* XMLHttpRequestUpload::executionContext() const | 51 ExecutionContext* XMLHttpRequestUpload::executionContext() const |
50 { | 52 { |
51 return m_xmlHttpRequest->executionContext(); | 53 return m_xmlHttpRequest->executionContext(); |
52 } | 54 } |
53 | 55 |
| 56 void XMLHttpRequestUpload::dispatchProgressEvent(unsigned long long bytesSent, u
nsigned long long totalBytesToBeSent) |
| 57 { |
| 58 m_lastBytesSent = bytesSent; |
| 59 m_lastTotalBytesToBeSent = totalBytesToBeSent; |
| 60 dispatchEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::progress,
true, bytesSent, totalBytesToBeSent)); |
| 61 } |
| 62 |
54 void XMLHttpRequestUpload::dispatchEventAndLoadEnd(PassRefPtr<Event> event) | 63 void XMLHttpRequestUpload::dispatchEventAndLoadEnd(PassRefPtr<Event> event) |
55 { | 64 { |
56 ASSERT(event->type() == EventTypeNames::load || event->type() == EventTypeNa
mes::abort || event->type() == EventTypeNames::error || event->type() == EventTy
peNames::timeout); | 65 ASSERT(event->type() == EventTypeNames::load || event->type() == EventTypeNa
mes::abort || event->type() == EventTypeNames::error || event->type() == EventTy
peNames::timeout); |
57 | 66 |
58 dispatchEvent(event); | 67 dispatchEvent(event); |
59 dispatchEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::loadend)); | 68 dispatchEvent(XMLHttpRequestProgressEvent::create(EventTypeNames::loadend)); |
60 } | 69 } |
61 | 70 |
62 | 71 |
63 | 72 |
64 } // namespace WebCore | 73 } // namespace WebCore |
OLD | NEW |