summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-09-11 21:15:15 -0700
committerAndreas Kling <kling@serenityos.org>2021-09-12 16:39:23 +0200
commitbca8707e1520133788f3a299a324a8b0d04dd02e (patch)
tree2e7db9bd96f9e27256321cb85cec587e38a6383e /Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
parent1d4be9ca33ce12265c161b2da6a8182ea14bc314 (diff)
downloadserenity-bca8707e1520133788f3a299a324a8b0d04dd02e.zip
LibWeb: Start tracking elapsed time when a resource is loaded
Diffstat (limited to 'Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp')
-rw-r--r--Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
index 99d52c4fb8..33df84b933 100644
--- a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
+++ b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
@@ -7,6 +7,7 @@
#include <AK/Base64.h>
#include <AK/Debug.h>
#include <AK/JsonObject.h>
+#include <LibCore/ElapsedTimer.h>
#include <LibCore/EventLoop.h>
#include <LibCore/File.h>
#include <LibProtocol/Request.h>
@@ -32,7 +33,7 @@ ResourceLoader::ResourceLoader()
{
}
-void ResourceLoader::load_sync(const LoadRequest& request, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback)
+void ResourceLoader::load_sync(LoadRequest& request, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback)
{
Core::EventLoop loop;
@@ -53,7 +54,7 @@ void ResourceLoader::load_sync(const LoadRequest& request, Function<void(Readonl
static HashMap<LoadRequest, NonnullRefPtr<Resource>> s_resource_cache;
-RefPtr<Resource> ResourceLoader::load_resource(Resource::Type type, const LoadRequest& request)
+RefPtr<Resource> ResourceLoader::load_resource(Resource::Type type, LoadRequest& request)
{
if (!request.is_valid())
return nullptr;
@@ -92,6 +93,7 @@ RefPtr<Resource> ResourceLoader::load_resource(Resource::Type type, const LoadRe
void ResourceLoader::load(const LoadRequest& request, Function<void(ReadonlyBytes, const HashMap<String, String, CaseInsensitiveStringTraits>& response_headers, Optional<u32> status_code)> success_callback, Function<void(const String&, Optional<u32> status_code)> error_callback)
{
auto& url = request.url();
+ request.start_timer();
if (is_port_blocked(url.port())) {
dbgln("ResourceLoader::load: Error: blocked port {} from URL {}", url.port(), url);