Skip to content
Permalink
Browse files
Remove allocation of SubresourceLoader::m_requestCountTracker
https://bugs.webkit.org/show_bug.cgi?id=158255

Reviewed by Chris Dumez.

No change of behavior.

Making m_requestCountTracker an Optional in lieu of a unique_ptr.
This requires constructing m_requestCountTracker in place so that constructor and destructor are called only once.

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::SubresourceLoader):
(WebCore::SubresourceLoader::didReceiveResponse):
(WebCore::SubresourceLoader::notifyDone):
* loader/SubresourceLoader.h:


Canonical link: https://commits.webkit.org/176352@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201556 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
youennf committed Jun 1, 2016
1 parent 506ff54 commit 70ac37b676c55ea0464d623db19b9d0e914d4d33
Showing with 22 additions and 4 deletions.
  1. +18 −0 Source/WebCore/ChangeLog
  2. +3 −3 Source/WebCore/loader/SubresourceLoader.cpp
  3. +1 −1 Source/WebCore/loader/SubresourceLoader.h
@@ -1,3 +1,21 @@
2016-06-01 Youenn Fablet <youenn.fablet@crf.canon.fr>

Remove allocation of SubresourceLoader::m_requestCountTracker
https://bugs.webkit.org/show_bug.cgi?id=158255

Reviewed by Chris Dumez.

No change of behavior.

Making m_requestCountTracker an Optional in lieu of a unique_ptr.
This requires constructing m_requestCountTracker in place so that constructor and destructor are called only once.

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::SubresourceLoader):
(WebCore::SubresourceLoader::didReceiveResponse):
(WebCore::SubresourceLoader::notifyDone):
* loader/SubresourceLoader.h:

2016-06-01 Antti Koivisto <antti@apple.com>

Remove accidental fprintf.
@@ -78,7 +78,7 @@ SubresourceLoader::SubresourceLoader(Frame* frame, CachedResource* resource, con
, m_resource(resource)
, m_loadingMultipartContent(false)
, m_state(Uninitialized)
, m_requestCountTracker(std::make_unique<RequestCountTracker>(frame->document()->cachedResourceLoader(), resource))
, m_requestCountTracker(InPlace, frame->document()->cachedResourceLoader(), resource)
{
#ifndef NDEBUG
subresourceLoaderCounter.increment();
@@ -283,7 +283,7 @@ void SubresourceLoader::didReceiveResponse(const ResourceResponse& response)
m_loadingMultipartContent = true;

// We don't count multiParts in a CachedResourceLoader's request count
m_requestCountTracker = nullptr;
m_requestCountTracker = Nullopt;
if (!m_resource->isImage()) {
cancel();
return;
@@ -514,7 +514,7 @@ void SubresourceLoader::notifyDone()
if (reachedTerminalState())
return;

m_requestCountTracker = nullptr;
m_requestCountTracker = Nullopt;
#if PLATFORM(IOS)
m_documentLoader->cachedResourceLoader().loadDone(m_resource, m_state != CancelledWhileInitializing);
#else
@@ -125,7 +125,7 @@ class SubresourceLoader final : public ResourceLoader {
CachedResource* m_resource;
bool m_loadingMultipartContent;
SubresourceLoaderState m_state;
std::unique_ptr<RequestCountTracker> m_requestCountTracker;
Optional<RequestCountTracker> m_requestCountTracker;
RefPtr<SecurityOrigin> m_origin;
};

0 comments on commit 70ac37b

Please sign in to comment.