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

Side by Side Diff: Source/core/xml/XMLHttpRequestUpload.cpp

Issue 63033008: Move delivery of upload 'progress' events to XMLHttpRequestUpload. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « Source/core/xml/XMLHttpRequestUpload.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « Source/core/xml/XMLHttpRequestUpload.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698