Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Unified Diff: content/child/resource_dispatcher.cc

Issue 2449933003: Use Associated interfaces for mojo-loading (Closed)
Patch Set: fix Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/resource_dispatcher.h ('k') | content/child/resource_dispatcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/resource_dispatcher.cc
diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc
index 1f70ee417f808d115c4a293c4ff1505999c2a3b1..7b1e4ab03c0a7367084d2afecd4425bd20fedb65 100644
--- a/content/child/resource_dispatcher.cc
+++ b/content/child/resource_dispatcher.cc
@@ -39,7 +39,9 @@
#include "content/public/common/content_features.h"
#include "content/public/common/resource_response.h"
#include "content/public/common/resource_type.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/associated_binding.h"
+#include "mojo/public/cpp/bindings/associated_group.h"
+#include "mojo/public/cpp/bindings/associated_interface_ptr_info.h"
#include "net/base/net_errors.h"
#include "net/base/request_priority.h"
#include "net/http/http_response_headers.h"
@@ -114,12 +116,13 @@ class URLLoaderClientImpl final : public mojom::URLLoaderClient {
body_consumer_->OnComplete(status);
}
- mojom::URLLoaderClientPtr CreateInterfacePtrAndBind() {
- return binding_.CreateInterfacePtrAndBind();
+ void Bind(mojom::URLLoaderClientAssociatedPtrInfo* client_ptr_info,
+ mojo::AssociatedGroup* associated_group) {
+ binding_.Bind(client_ptr_info, associated_group);
}
private:
- mojo::Binding<mojom::URLLoaderClient> binding_;
+ mojo::AssociatedBinding<mojom::URLLoaderClient> binding_;
scoped_refptr<URLResponseBodyConsumer> body_consumer_;
const int request_id_;
bool has_received_response_ = false;
@@ -661,7 +664,8 @@ int ResourceDispatcher::StartAsync(
const GURL& frame_origin,
std::unique_ptr<RequestPeer> peer,
blink::WebURLRequest::LoadingIPCType ipc_type,
- mojom::URLLoaderFactory* url_loader_factory) {
+ mojom::URLLoaderFactory* url_loader_factory,
+ mojo::AssociatedGroup* associated_group) {
CheckSchemeForReferrerPolicy(*request);
// Compute a unique request_id for this renderer process.
@@ -678,10 +682,12 @@ int ResourceDispatcher::StartAsync(
if (ipc_type == blink::WebURLRequest::LoadingIPCType::Mojo) {
std::unique_ptr<URLLoaderClientImpl> client(
new URLLoaderClientImpl(request_id, this, main_thread_task_runner_));
- mojom::URLLoaderPtr url_loader;
+ mojom::URLLoaderAssociatedPtr url_loader;
+ mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info;
+ client->Bind(&client_ptr_info, associated_group);
url_loader_factory->CreateLoaderAndStart(
- GetProxy(&url_loader), routing_id, request_id, *request,
- client->CreateInterfacePtrAndBind());
+ GetProxy(&url_loader, associated_group), routing_id, request_id,
+ *request, std::move(client_ptr_info));
pending_requests_[request_id]->url_loader = std::move(url_loader);
pending_requests_[request_id]->url_loader_client = std::move(client);
} else {
« no previous file with comments | « content/child/resource_dispatcher.h ('k') | content/child/resource_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698