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

Side by Side Diff: Source/core/page/EventSource.cpp

Issue 301243015: Refactor ThreadableLoaderOptions for readability (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Ericsson AB. All rights reserved. 2 * Copyright (C) 2009, 2012 Ericsson AB. All rights reserved.
3 * Copyright (C) 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2010 Apple Inc. All rights reserved.
4 * Copyright (C) 2011, Code Aurora Forum. All rights reserved. 4 * Copyright (C) 2011, Code Aurora Forum. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 ResourceRequest request(m_url); 130 ResourceRequest request(m_url);
131 request.setHTTPMethod("GET"); 131 request.setHTTPMethod("GET");
132 request.setHTTPHeaderField("Accept", "text/event-stream"); 132 request.setHTTPHeaderField("Accept", "text/event-stream");
133 request.setHTTPHeaderField("Cache-Control", "no-cache"); 133 request.setHTTPHeaderField("Cache-Control", "no-cache");
134 if (!m_lastEventId.isEmpty()) 134 if (!m_lastEventId.isEmpty())
135 request.setHTTPHeaderField("Last-Event-ID", m_lastEventId); 135 request.setHTTPHeaderField("Last-Event-ID", m_lastEventId);
136 136
137 SecurityOrigin* origin = executionContext.securityOrigin(); 137 SecurityOrigin* origin = executionContext.securityOrigin();
138 138
139 ThreadableLoaderOptions options; 139 ThreadableLoaderOptions options;
140 options.sniffContent = DoNotSniffContent;
141 options.allowCredentials = (origin->canRequest(m_url) || m_withCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials;
142 options.credentialsRequested = m_withCredentials ? ClientRequestedCredential s : ClientDidNotRequestCredentials;
143 options.preflightPolicy = PreventPreflight; 140 options.preflightPolicy = PreventPreflight;
144 options.crossOriginRequestPolicy = UseAccessControl; 141 options.crossOriginRequestPolicy = UseAccessControl;
145 options.dataBufferingPolicy = DoNotBufferData;
146 options.securityOrigin = origin;
147 options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypa ssMainWorld(&executionContext) ? DoNotEnforceContentSecurityPolicy : EnforceConn ectSrcDirective; 142 options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypa ssMainWorld(&executionContext) ? DoNotEnforceContentSecurityPolicy : EnforceConn ectSrcDirective;
148 143
149 m_loader = ThreadableLoader::create(executionContext, this, request, options ); 144 ResourceLoaderOptions resourceLoaderOptions;
145 resourceLoaderOptions.sniffContent = DoNotSniffContent;
tkent 2014/06/02 08:08:56 Ditto.
tyoshino (SeeGerritForStatus) 2014/06/02 08:21:35 Done.
146 resourceLoaderOptions.allowCredentials = (origin->canRequest(m_url) || m_wit hCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials;
147 resourceLoaderOptions.credentialsRequested = m_withCredentials ? ClientReque stedCredentials : ClientDidNotRequestCredentials;
148 resourceLoaderOptions.dataBufferingPolicy = DoNotBufferData;
149 resourceLoaderOptions.securityOrigin = origin;
150
151 m_loader = ThreadableLoader::create(executionContext, this, request, options , resourceLoaderOptions);
150 152
151 if (m_loader) 153 if (m_loader)
152 m_requestInFlight = true; 154 m_requestInFlight = true;
153 } 155 }
154 156
155 void EventSource::networkRequestEnded() 157 void EventSource::networkRequestEnded()
156 { 158 {
157 if (!m_requestInFlight) 159 if (!m_requestInFlight)
158 return; 160 return;
159 161
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 430
429 PassRefPtrWillBeRawPtr<MessageEvent> EventSource::createMessageEvent() 431 PassRefPtrWillBeRawPtr<MessageEvent> EventSource::createMessageEvent()
430 { 432 {
431 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(); 433 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create();
432 event->initMessageEvent(m_eventName.isEmpty() ? EventTypeNames::message : m_ eventName, false, false, SerializedScriptValue::create(String(m_data)), m_eventS treamOrigin, m_lastEventId, 0, nullptr); 434 event->initMessageEvent(m_eventName.isEmpty() ? EventTypeNames::message : m_ eventName, false, false, SerializedScriptValue::create(String(m_data)), m_eventS treamOrigin, m_lastEventId, 0, nullptr);
433 m_data.clear(); 435 m_data.clear();
434 return event.release(); 436 return event.release();
435 } 437 }
436 438
437 } // namespace WebCore 439 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698