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

Side by Side Diff: content/browser/navigator_connect/service_port_service_impl.cc

Issue 1568073002: Reduce string copies in GURL creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/navigator_connect/service_port_service_impl.h" 5 #include "content/browser/navigator_connect/service_port_service_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/message_port_message_filter.h" 9 #include "content/browser/message_port_message_filter.h"
10 #include "content/browser/message_port_service.h" 10 #include "content/browser/message_port_service.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 void ServicePortServiceImpl::SetClient(ServicePortServiceClientPtr client) { 84 void ServicePortServiceImpl::SetClient(ServicePortServiceClientPtr client) {
85 DCHECK(!client_.get()); 85 DCHECK(!client_.get());
86 // TODO(mek): Set ErrorHandler to listen for errors. 86 // TODO(mek): Set ErrorHandler to listen for errors.
87 client_ = std::move(client); 87 client_ = std::move(client);
88 } 88 }
89 89
90 void ServicePortServiceImpl::Connect(const mojo::String& target_url, 90 void ServicePortServiceImpl::Connect(const mojo::String& target_url,
91 const mojo::String& origin, 91 const mojo::String& origin,
92 const ConnectCallback& callback) { 92 const ConnectCallback& callback) {
93 navigator_connect_context_->Connect( 93 navigator_connect_context_->Connect(
94 GURL(target_url), GURL(origin), this, 94 GURL(target_url.get()), GURL(origin.get()), this,
95 base::Bind(&ServicePortServiceImpl::OnConnectResult, 95 base::Bind(&ServicePortServiceImpl::OnConnectResult,
96 weak_ptr_factory_.GetWeakPtr(), callback)); 96 weak_ptr_factory_.GetWeakPtr(), callback));
97 } 97 }
98 98
99 void ServicePortServiceImpl::PostMessageToPort( 99 void ServicePortServiceImpl::PostMessageToPort(
100 int32_t port_id, 100 int32_t port_id,
101 const mojo::String& message, 101 const mojo::String& message,
102 mojo::Array<MojoTransferredMessagePortPtr> ports) { 102 mojo::Array<MojoTransferredMessagePortPtr> ports) {
103 // TODO(mek): Similar to http://crbug.com/490222 this code should make sure 103 // TODO(mek): Similar to http://crbug.com/490222 this code should make sure
104 // port_id belongs to the process this IPC was received from. 104 // port_id belongs to the process this IPC was received from.
(...skipping 18 matching lines...) Expand all
123 123
124 void ServicePortServiceImpl::OnConnectResult(const ConnectCallback& callback, 124 void ServicePortServiceImpl::OnConnectResult(const ConnectCallback& callback,
125 int message_port_id, 125 int message_port_id,
126 bool success) { 126 bool success) {
127 callback.Run(success ? SERVICE_PORT_CONNECT_RESULT_ACCEPT 127 callback.Run(success ? SERVICE_PORT_CONNECT_RESULT_ACCEPT
128 : SERVICE_PORT_CONNECT_RESULT_REJECT, 128 : SERVICE_PORT_CONNECT_RESULT_REJECT,
129 message_port_id); 129 message_port_id);
130 } 130 }
131 131
132 } // namespace content 132 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/frame_mojo_shell.cc ('k') | content/browser/permissions/permission_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698