1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:47:35 +00:00

LibWeb: Start tracking elapsed time when a resource is loaded

This commit is contained in:
Brian Gianforcaro 2021-09-11 21:15:15 -07:00 committed by Andreas Kling
parent 1d4be9ca33
commit bca8707e15
7 changed files with 17 additions and 9 deletions

View file

@ -8,7 +8,9 @@
#include <AK/ByteBuffer.h>
#include <AK/HashMap.h>
#include <AK/Time.h>
#include <AK/URL.h>
#include <LibCore/ElapsedTimer.h>
#include <LibWeb/Forward.h>
namespace Web {
@ -32,6 +34,9 @@ public:
const ByteBuffer& body() const { return m_body; }
void set_body(const ByteBuffer& body) { m_body = body; }
void start_timer() { m_load_timer.start(); };
Time load_time() const { return m_load_timer.elapsed_time(); }
unsigned hash() const
{
auto body_hash = string_hash((const char*)m_body.data(), m_body.size());
@ -64,6 +69,7 @@ private:
String m_method { "GET" };
HashMap<String, String> m_headers;
ByteBuffer m_body;
Core::ElapsedTimer m_load_timer;
};
}