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

Side by Side Diff: Source/core/fetch/ResourceLoader.cpp

Issue 100563004: Redirect HTML resource bytes directly to parser thread (Blink side CL) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@parserthread_decodermove
Patch Set: Leak fix Created 6 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) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved.
3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 22 matching lines...) Expand all
33 #include "core/fetch/Resource.h" 33 #include "core/fetch/Resource.h"
34 #include "core/fetch/ResourceLoaderHost.h" 34 #include "core/fetch/ResourceLoaderHost.h"
35 #include "core/fetch/ResourcePtr.h" 35 #include "core/fetch/ResourcePtr.h"
36 #include "platform/Logging.h" 36 #include "platform/Logging.h"
37 #include "platform/SharedBuffer.h" 37 #include "platform/SharedBuffer.h"
38 #include "platform/exported/WrappedResourceRequest.h" 38 #include "platform/exported/WrappedResourceRequest.h"
39 #include "platform/exported/WrappedResourceResponse.h" 39 #include "platform/exported/WrappedResourceResponse.h"
40 #include "platform/network/ResourceError.h" 40 #include "platform/network/ResourceError.h"
41 #include "public/platform/Platform.h" 41 #include "public/platform/Platform.h"
42 #include "public/platform/WebData.h" 42 #include "public/platform/WebData.h"
43 #include "public/platform/WebThreadedDataReceiver.h"
43 #include "public/platform/WebURLError.h" 44 #include "public/platform/WebURLError.h"
44 #include "public/platform/WebURLRequest.h" 45 #include "public/platform/WebURLRequest.h"
45 #include "public/platform/WebURLResponse.h" 46 #include "public/platform/WebURLResponse.h"
46 #include "wtf/Assertions.h" 47 #include "wtf/Assertions.h"
47 #include "wtf/CurrentTime.h" 48 #include "wtf/CurrentTime.h"
48 49
49 namespace WebCore { 50 namespace WebCore {
50 51
51 ResourceLoader::RequestCountTracker::RequestCountTracker(ResourceLoaderHost* hos t, Resource* resource) 52 ResourceLoader::RequestCountTracker::RequestCountTracker(ResourceLoaderHost* hos t, Resource* resource)
52 : m_host(host) 53 : m_host(host)
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 m_defersLoading = defers; 174 m_defersLoading = defers;
174 if (m_loader) 175 if (m_loader)
175 m_loader->setDefersLoading(defers); 176 m_loader->setDefersLoading(defers);
176 if (!defers && !m_deferredRequest.isNull()) { 177 if (!defers && !m_deferredRequest.isNull()) {
177 m_request = m_deferredRequest; 178 m_request = m_deferredRequest;
178 m_deferredRequest = ResourceRequest(); 179 m_deferredRequest = ResourceRequest();
179 start(); 180 start();
180 } 181 }
181 } 182 }
182 183
184 void ResourceLoader::attachThreadedDataReceiver(PassOwnPtr<blink::WebThreadedDat aReceiver> threadedDataReceiver)
185 {
186 if (m_loader) {
187 // The implementor of the WebURLLoader assumes ownership of the
188 // threaded data receiver if it signals that it got successfully
189 // attached.
190 blink::WebThreadedDataReceiver* rawThreadedDataReceiver = threadedDataRe ceiver.leakPtr();
191 if (!m_loader->attachThreadedDataReceiver(rawThreadedDataReceiver))
192 delete rawThreadedDataReceiver;
193 }
194 }
195
183 void ResourceLoader::didDownloadData(blink::WebURLLoader*, int length, int encod edDataLength) 196 void ResourceLoader::didDownloadData(blink::WebURLLoader*, int length, int encod edDataLength)
184 { 197 {
185 RefPtr<ResourceLoader> protect(this); 198 RefPtr<ResourceLoader> protect(this);
186 RELEASE_ASSERT(m_connectionState == ConnectionStateReceivedResponse); 199 RELEASE_ASSERT(m_connectionState == ConnectionStateReceivedResponse);
187 m_host->didDownloadData(m_resource, length, encodedDataLength); 200 m_host->didDownloadData(m_resource, length, encodedDataLength);
188 m_resource->didDownloadData(length); 201 m_resource->didDownloadData(length);
189 } 202 }
190 203
191 void ResourceLoader::didFinishLoadingOnePart(double finishTime, int64 encodedDat aLength) 204 void ResourceLoader::didFinishLoadingOnePart(double finishTime, int64 encodedDat aLength)
192 { 205 {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 if (m_state == Terminated) 483 if (m_state == Terminated)
471 return; 484 return;
472 RefPtr<ResourceLoadInfo> resourceLoadInfo = responseOut.toResourceResponse() .resourceLoadInfo(); 485 RefPtr<ResourceLoadInfo> resourceLoadInfo = responseOut.toResourceResponse() .resourceLoadInfo();
473 int64 encodedDataLength = resourceLoadInfo ? resourceLoadInfo->encodedDataLe ngth : blink::WebURLLoaderClient::kUnknownEncodedDataLength; 486 int64 encodedDataLength = resourceLoadInfo ? resourceLoadInfo->encodedDataLe ngth : blink::WebURLLoaderClient::kUnknownEncodedDataLength;
474 m_host->didReceiveData(m_resource, dataOut.data(), dataOut.size(), encodedDa taLength); 487 m_host->didReceiveData(m_resource, dataOut.data(), dataOut.size(), encodedDa taLength);
475 m_resource->setResourceBuffer(dataOut); 488 m_resource->setResourceBuffer(dataOut);
476 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); 489 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength);
477 } 490 }
478 491
479 } 492 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698