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

Side by Side Diff: Source/modules/websockets/DOMWebSocket.cpp

Issue 1033243003: Upgrade: Measure websocket upgrades as well as other subresources. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 27 matching lines...) Expand all
38 #include "core/dom/DOMArrayBufferView.h" 38 #include "core/dom/DOMArrayBufferView.h"
39 #include "core/dom/Document.h" 39 #include "core/dom/Document.h"
40 #include "core/dom/ExceptionCode.h" 40 #include "core/dom/ExceptionCode.h"
41 #include "core/dom/ExecutionContext.h" 41 #include "core/dom/ExecutionContext.h"
42 #include "core/dom/SecurityContext.h" 42 #include "core/dom/SecurityContext.h"
43 #include "core/events/MessageEvent.h" 43 #include "core/events/MessageEvent.h"
44 #include "core/fileapi/Blob.h" 44 #include "core/fileapi/Blob.h"
45 #include "core/frame/ConsoleTypes.h" 45 #include "core/frame/ConsoleTypes.h"
46 #include "core/frame/LocalDOMWindow.h" 46 #include "core/frame/LocalDOMWindow.h"
47 #include "core/frame/LocalFrame.h" 47 #include "core/frame/LocalFrame.h"
48 #include "core/frame/UseCounter.h"
48 #include "core/frame/csp/ContentSecurityPolicy.h" 49 #include "core/frame/csp/ContentSecurityPolicy.h"
49 #include "core/inspector/ConsoleMessage.h" 50 #include "core/inspector/ConsoleMessage.h"
50 #include "core/inspector/ScriptCallStack.h" 51 #include "core/inspector/ScriptCallStack.h"
51 #include "modules/websockets/CloseEvent.h" 52 #include "modules/websockets/CloseEvent.h"
52 #include "platform/Logging.h" 53 #include "platform/Logging.h"
53 #include "platform/blob/BlobData.h" 54 #include "platform/blob/BlobData.h"
54 #include "platform/heap/Handle.h" 55 #include "platform/heap/Handle.h"
55 #include "platform/weborigin/KnownPorts.h" 56 #include "platform/weborigin/KnownPorts.h"
56 #include "platform/weborigin/SecurityOrigin.h" 57 #include "platform/weborigin/SecurityOrigin.h"
57 #include "public/platform/Platform.h" 58 #include "public/platform/Platform.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 return webSocket; 276 return webSocket;
276 } 277 }
277 278
278 void DOMWebSocket::connect(const String& url, const Vector<String>& protocols, E xceptionState& exceptionState) 279 void DOMWebSocket::connect(const String& url, const Vector<String>& protocols, E xceptionState& exceptionState)
279 { 280 {
280 281
281 WTF_LOG(Network, "WebSocket %p connect() url='%s'", this, url.utf8().data()) ; 282 WTF_LOG(Network, "WebSocket %p connect() url='%s'", this, url.utf8().data()) ;
282 m_url = KURL(KURL(), url); 283 m_url = KURL(KURL(), url);
283 284
284 if (executionContext()->securityContext().insecureRequestsPolicy() == Securi tyContext::InsecureRequestsUpgrade && m_url.protocol() == "ws") { 285 if (executionContext()->securityContext().insecureRequestsPolicy() == Securi tyContext::InsecureRequestsUpgrade && m_url.protocol() == "ws") {
286 UseCounter::count(executionContext(), UseCounter::UpgradeInsecureRequest sUpgradedRequest);
285 m_url.setProtocol("wss"); 287 m_url.setProtocol("wss");
286 if (m_url.port() == 80) 288 if (m_url.port() == 80)
287 m_url.setPort(443); 289 m_url.setPort(443);
288 } 290 }
289 291
290 if (!m_url.isValid()) { 292 if (!m_url.isValid()) {
291 m_state = CLOSED; 293 m_state = CLOSED;
292 exceptionState.throwDOMException(SyntaxError, "The URL '" + url + "' is invalid."); 294 exceptionState.throwDOMException(SyntaxError, "The URL '" + url + "' is invalid.");
293 return; 295 return;
294 } 296 }
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 DEFINE_TRACE(DOMWebSocket) 684 DEFINE_TRACE(DOMWebSocket)
683 { 685 {
684 visitor->trace(m_channel); 686 visitor->trace(m_channel);
685 visitor->trace(m_eventQueue); 687 visitor->trace(m_eventQueue);
686 WebSocketChannelClient::trace(visitor); 688 WebSocketChannelClient::trace(visitor);
687 RefCountedGarbageCollectedEventTargetWithInlineData<DOMWebSocket>::trace(vis itor); 689 RefCountedGarbageCollectedEventTargetWithInlineData<DOMWebSocket>::trace(vis itor);
688 ActiveDOMObject::trace(visitor); 690 ActiveDOMObject::trace(visitor);
689 } 691 }
690 692
691 } // namespace blink 693 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698