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

Side by Side Diff: third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestUpload.cpp

Issue 2727633006: DevTools: Rename InspectorInstrumentation:: namespace into probe:: (Closed)
Patch Set: Created 3 years, 9 months 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) 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 ExecutionContext* XMLHttpRequestUpload::getExecutionContext() const { 45 ExecutionContext* XMLHttpRequestUpload::getExecutionContext() const {
46 return m_xmlHttpRequest->getExecutionContext(); 46 return m_xmlHttpRequest->getExecutionContext();
47 } 47 }
48 48
49 void XMLHttpRequestUpload::dispatchProgressEvent( 49 void XMLHttpRequestUpload::dispatchProgressEvent(
50 unsigned long long bytesSent, 50 unsigned long long bytesSent,
51 unsigned long long totalBytesToBeSent) { 51 unsigned long long totalBytesToBeSent) {
52 m_lastBytesSent = bytesSent; 52 m_lastBytesSent = bytesSent;
53 m_lastTotalBytesToBeSent = totalBytesToBeSent; 53 m_lastTotalBytesToBeSent = totalBytesToBeSent;
54 InspectorInstrumentation::AsyncTask asyncTask( 54 probe::AsyncTask asyncTask(getExecutionContext(), m_xmlHttpRequest,
55 getExecutionContext(), m_xmlHttpRequest, m_xmlHttpRequest->isAsync()); 55 m_xmlHttpRequest->isAsync());
56 dispatchEvent(ProgressEvent::create(EventTypeNames::progress, true, bytesSent, 56 dispatchEvent(ProgressEvent::create(EventTypeNames::progress, true, bytesSent,
57 totalBytesToBeSent)); 57 totalBytesToBeSent));
58 } 58 }
59 59
60 void XMLHttpRequestUpload::dispatchEventAndLoadEnd(const AtomicString& type, 60 void XMLHttpRequestUpload::dispatchEventAndLoadEnd(const AtomicString& type,
61 bool lengthComputable, 61 bool lengthComputable,
62 unsigned long long bytesSent, 62 unsigned long long bytesSent,
63 unsigned long long total) { 63 unsigned long long total) {
64 DCHECK(type == EventTypeNames::load || type == EventTypeNames::abort || 64 DCHECK(type == EventTypeNames::load || type == EventTypeNames::abort ||
65 type == EventTypeNames::error || type == EventTypeNames::timeout); 65 type == EventTypeNames::error || type == EventTypeNames::timeout);
66 InspectorInstrumentation::AsyncTask asyncTask( 66 probe::AsyncTask asyncTask(getExecutionContext(), m_xmlHttpRequest,
67 getExecutionContext(), m_xmlHttpRequest, m_xmlHttpRequest->isAsync()); 67 m_xmlHttpRequest->isAsync());
68 dispatchEvent( 68 dispatchEvent(
69 ProgressEvent::create(type, lengthComputable, bytesSent, total)); 69 ProgressEvent::create(type, lengthComputable, bytesSent, total));
70 dispatchEvent(ProgressEvent::create(EventTypeNames::loadend, lengthComputable, 70 dispatchEvent(ProgressEvent::create(EventTypeNames::loadend, lengthComputable,
71 bytesSent, total)); 71 bytesSent, total));
72 } 72 }
73 73
74 void XMLHttpRequestUpload::handleRequestError(const AtomicString& type) { 74 void XMLHttpRequestUpload::handleRequestError(const AtomicString& type) {
75 bool lengthComputable = m_lastTotalBytesToBeSent > 0 && 75 bool lengthComputable = m_lastTotalBytesToBeSent > 0 &&
76 m_lastBytesSent <= m_lastTotalBytesToBeSent; 76 m_lastBytesSent <= m_lastTotalBytesToBeSent;
77 InspectorInstrumentation::AsyncTask asyncTask( 77 probe::AsyncTask asyncTask(getExecutionContext(), m_xmlHttpRequest,
78 getExecutionContext(), m_xmlHttpRequest, m_xmlHttpRequest->isAsync()); 78 m_xmlHttpRequest->isAsync());
79 dispatchEvent(ProgressEvent::create(EventTypeNames::progress, 79 dispatchEvent(ProgressEvent::create(EventTypeNames::progress,
80 lengthComputable, m_lastBytesSent, 80 lengthComputable, m_lastBytesSent,
81 m_lastTotalBytesToBeSent)); 81 m_lastTotalBytesToBeSent));
82 dispatchEventAndLoadEnd(type, lengthComputable, m_lastBytesSent, 82 dispatchEventAndLoadEnd(type, lengthComputable, m_lastBytesSent,
83 m_lastTotalBytesToBeSent); 83 m_lastTotalBytesToBeSent);
84 } 84 }
85 85
86 DEFINE_TRACE(XMLHttpRequestUpload) { 86 DEFINE_TRACE(XMLHttpRequestUpload) {
87 visitor->trace(m_xmlHttpRequest); 87 visitor->trace(m_xmlHttpRequest);
88 XMLHttpRequestEventTarget::trace(visitor); 88 XMLHttpRequestEventTarget::trace(visitor);
89 } 89 }
90 90
91 } // namespace blink 91 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698