The thing is that ProcessRequest is currently designed to be a synchronized call. CefUrlRequestJob took care of threading. But it can still be made into an asynchronous call, by putting an extra "IsRequestComplete" method into the interface. And have CefUrlRequestJob::DidResolve or CefUrlRequestJob::ReturnResults check whether the process is complete. ProcessRequest could return immediately, without knowing mimetype or size.
If mimetype and size are moved to ProcessRequest, then it has to be a synchronized call.
Plus, theoretically, the response can also be put into ProcessRequest as a parameter, because the response should become available after ProcessRequest. This way, ReadResponse could be offloaded to CefUrlRequestJob, and the client only have to return a byte sequence. So it could become:
- Code: Select all
virtual bool ProcessRequest(CefRefPtr<CefRequest> request, std::wstring& mime_type, vector<unsigned char>& response) = 0;
Is this a good idea? It works but isn't it too limited?