25
25
*/
26
26
27
27
#include < AK/Base64.h>
28
+ #include < AK/Debug.h>
28
29
#include < AK/JsonObject.h>
29
30
#include < LibCore/EventLoop.h>
30
31
#include < LibCore/File.h>
35
36
#include < LibWeb/Loader/Resource.h>
36
37
#include < LibWeb/Loader/ResourceLoader.h>
37
38
38
- // #define CACHE_DEBUG
39
-
40
39
namespace Web {
41
40
42
41
ResourceLoader& ResourceLoader::the ()
@@ -82,11 +81,9 @@ RefPtr<Resource> ResourceLoader::load_resource(Resource::Type type, const LoadRe
82
81
auto it = s_resource_cache.find (request);
83
82
if (it != s_resource_cache.end ()) {
84
83
if (it->value ->type () != type) {
85
- dbg () << " FIXME: Not using cached resource for " << request. url () << " since there's a type mismatch." ;
84
+ dbgln ( " FIXME: Not using cached resource for {} since there's a type mismatch." , request. url ()) ;
86
85
} else {
87
- #ifdef CACHE_DEBUG
88
- dbg () << " Reusing cached resource for: " << request.url ();
89
- #endif
86
+ dbgln<debug_cache>(" Reusing cached resource for: {}" , request.url ());
90
87
return it->value ;
91
88
}
92
89
}
@@ -112,7 +109,7 @@ void ResourceLoader::load(const LoadRequest& request, Function<void(ReadonlyByte
112
109
auto & url = request.url ();
113
110
114
111
if (is_port_blocked (url.port ())) {
115
- dbg () << " ResourceLoader::load: Error: blocked port " << url.port () << " for URL: " << url;
112
+ dbgln ( " ResourceLoader::load: Error: blocked port {} from URL {} " , url.port (), url) ;
116
113
return ;
117
114
}
118
115
@@ -123,15 +120,18 @@ void ResourceLoader::load(const LoadRequest& request, Function<void(ReadonlyByte
123
120
}
124
121
125
122
if (url.protocol () == " about" ) {
126
- dbg () << " Loading about: URL " << url;
123
+ dbgln ( " Loading about: URL {} " , url) ;
127
124
deferred_invoke ([success_callback = move (success_callback)](auto &) {
128
125
success_callback (String::empty ().to_byte_buffer (), {});
129
126
});
130
127
return ;
131
128
}
132
129
133
130
if (url.protocol () == " data" ) {
134
- dbg () << " ResourceLoader loading a data URL with mime-type: '" << url.data_mime_type () << " ', base64=" << url.data_payload_is_base64 () << " , payload='" << url.data_payload () << " '" ;
131
+ dbgln (" ResourceLoader loading a data URL with mime-type: '{}', base64={}, payload='{}'" ,
132
+ url.data_mime_type (),
133
+ url.data_payload_is_base64 (),
134
+ url.data_payload ());
135
135
136
136
ByteBuffer data;
137
137
if (url.data_payload_is_base64 ())
@@ -149,7 +149,7 @@ void ResourceLoader::load(const LoadRequest& request, Function<void(ReadonlyByte
149
149
auto f = Core::File::construct ();
150
150
f->set_filename (url.path ());
151
151
if (!f->open (Core::IODevice::OpenMode::ReadOnly)) {
152
- dbg () << " ResourceLoader::load: Error: " << f->error_string ();
152
+ dbgln ( " ResourceLoader::load: Error: {} " , f->error_string () );
153
153
if (error_callback)
154
154
error_callback (f->error_string ());
155
155
return ;
0 commit comments