mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:32:46 +00:00 
			
		
		
		
	 2198091bbc
			
		
	
	
		2198091bbc
		
	
	
	
	
		
			
			After this change, LibWeb now expects Web::ImageDecoding::Decoder to be pre-initialized with a concrete implementation before using the webpage. The previous implementation, based on the ImageDecoder service, has been provided directly through an adapter in LibWebClient, and is now used as the default value by WebContent.
		
			
				
	
	
		
			32 lines
		
	
	
	
		
			609 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			609 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
 | |
|  * Copyright (c) 2022, Dex♪ <dexes.ttp@gmail.com>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <LibWeb/ImageDecoding.h>
 | |
| 
 | |
| namespace Web::ImageDecoding {
 | |
| 
 | |
| static RefPtr<Decoder> s_decoder;
 | |
| 
 | |
| Decoder::Decoder() = default;
 | |
| 
 | |
| Decoder::~Decoder() = default;
 | |
| 
 | |
| void Decoder::initialize(RefPtr<Decoder>&& decoder)
 | |
| {
 | |
|     s_decoder = move(decoder);
 | |
| }
 | |
| 
 | |
| Decoder& Decoder::the()
 | |
| {
 | |
|     if (!s_decoder) [[unlikely]] {
 | |
|         dbgln("Web::ImageDecoding::Decoder was not initialized!");
 | |
|         VERIFY_NOT_REACHED();
 | |
|     }
 | |
|     return *s_decoder;
 | |
| }
 | |
| 
 | |
| }
 |