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

Side by Side Diff: content/child/navigator_connect/service_port_provider.cc

Issue 1409223004: mandoline: Add automatic tracing at mojo call sites. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Safety rebase to ToT Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/child/navigator_connect/service_port_provider.h" 5 #include "content/child/navigator_connect/service_port_provider.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/task_runner_util.h" 9 #include "base/task_runner_util.h"
10 #include "content/child/child_thread_impl.h" 10 #include "content/child/child_thread_impl.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 base::Bind(&ServicePortProvider::PostMessageToBrowser, this, port_id, 73 base::Bind(&ServicePortProvider::PostMessageToBrowser, this, port_id,
74 // We cast WebString to string16 before crossing threads. 74 // We cast WebString to string16 before crossing threads.
75 // for thread-safety. 75 // for thread-safety.
76 static_cast<base::string16>(message))); 76 static_cast<base::string16>(message)));
77 } 77 }
78 78
79 void ServicePortProvider::closePort(blink::WebServicePortID port_id) { 79 void ServicePortProvider::closePort(blink::WebServicePortID port_id) {
80 GetServicePortServicePtr()->ClosePort(port_id); 80 GetServicePortServicePtr()->ClosePort(port_id);
81 } 81 }
82 82
83 void ServicePortProvider::PostMessage( 83 void ServicePortProvider::PostMessageToPort(
84 int32_t port_id, 84 int32_t port_id,
85 const mojo::String& message, 85 const mojo::String& message,
86 mojo::Array<MojoTransferredMessagePortPtr> ports, 86 mojo::Array<MojoTransferredMessagePortPtr> ports,
87 mojo::Array<int32_t> new_routing_ids) { 87 mojo::Array<int32_t> new_routing_ids) {
88 client_->postMessage(port_id, message.To<base::string16>(), 88 client_->postMessage(port_id, message.To<base::string16>(),
89 WebMessagePortChannelImpl::CreatePorts( 89 WebMessagePortChannelImpl::CreatePorts(
90 ports.To<std::vector<TransferredMessagePort>>(), 90 ports.To<std::vector<TransferredMessagePort>>(),
91 new_routing_ids.To<std::vector<int>>(), main_loop_)); 91 new_routing_ids.To<std::vector<int>>(), main_loop_));
92 } 92 }
93 93
94 ServicePortProvider::~ServicePortProvider() { 94 ServicePortProvider::~ServicePortProvider() {
95 } 95 }
96 96
97 void ServicePortProvider::PostMessageToBrowser( 97 void ServicePortProvider::PostMessageToBrowser(
98 int port_id, 98 int port_id,
99 const base::string16& message, 99 const base::string16& message,
100 const std::vector<TransferredMessagePort> ports) { 100 const std::vector<TransferredMessagePort> ports) {
101 GetServicePortServicePtr()->PostMessage( 101 GetServicePortServicePtr()->PostMessageToPort(
102 port_id, mojo::String::From(message), 102 port_id, mojo::String::From(message),
103 mojo::Array<MojoTransferredMessagePortPtr>::From(ports)); 103 mojo::Array<MojoTransferredMessagePortPtr>::From(ports));
104 } 104 }
105 105
106 void ServicePortProvider::OnConnectResult( 106 void ServicePortProvider::OnConnectResult(
107 scoped_ptr<blink::WebServicePortConnectCallbacks> callbacks, 107 scoped_ptr<blink::WebServicePortConnectCallbacks> callbacks,
108 ServicePortConnectResult result, 108 ServicePortConnectResult result,
109 int32_t port_id) { 109 int32_t port_id) {
110 if (result == SERVICE_PORT_CONNECT_RESULT_ACCEPT) { 110 if (result == SERVICE_PORT_CONNECT_RESULT_ACCEPT) {
111 callbacks->onSuccess(new blink::WebServicePortID(port_id)); 111 callbacks->onSuccess(new blink::WebServicePortID(port_id));
(...skipping 11 matching lines...) Expand all
123 123
124 // Setup channel for browser to post events back to this class. 124 // Setup channel for browser to post events back to this class.
125 ServicePortServiceClientPtr client_ptr; 125 ServicePortServiceClientPtr client_ptr;
126 binding_.Bind(GetProxy(&client_ptr)); 126 binding_.Bind(GetProxy(&client_ptr));
127 service_port_service_->SetClient(client_ptr.Pass()); 127 service_port_service_->SetClient(client_ptr.Pass());
128 } 128 }
129 return service_port_service_; 129 return service_port_service_;
130 } 130 }
131 131
132 } // namespace content 132 } // namespace content
OLDNEW
« no previous file with comments | « content/child/navigator_connect/service_port_provider.h ('k') | content/common/service_port_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698