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

Side by Side Diff: content/browser/renderer_host/pepper/pepper_socket_utils.cc

Issue 2881673002: Avoid heap allocations in IPAddress (Closed)
Patch Set: Fix Assign Created 3 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer_host/pepper/pepper_socket_utils.h" 5 #include "content/browser/renderer_host/pepper/pepper_socket_utils.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 20 matching lines...) Expand all
31 31
32 namespace content { 32 namespace content {
33 namespace pepper_socket_utils { 33 namespace pepper_socket_utils {
34 34
35 SocketPermissionRequest CreateSocketPermissionRequest( 35 SocketPermissionRequest CreateSocketPermissionRequest(
36 SocketPermissionRequest::OperationType type, 36 SocketPermissionRequest::OperationType type,
37 const PP_NetAddress_Private& net_addr) { 37 const PP_NetAddress_Private& net_addr) {
38 std::string host = 38 std::string host =
39 ppapi::NetAddressPrivateImpl::DescribeNetAddress(net_addr, false); 39 ppapi::NetAddressPrivateImpl::DescribeNetAddress(net_addr, false);
40 uint16_t port = 0; 40 uint16_t port = 0;
41 std::vector<unsigned char> address; 41 net::IPAddressBytes address;
42 ppapi::NetAddressPrivateImpl::NetAddressToIPEndPoint( 42 ppapi::NetAddressPrivateImpl::NetAddressToIPEndPoint(
43 net_addr, &address, &port); 43 net_addr, &address, &port);
44 return SocketPermissionRequest(type, host, port); 44 return SocketPermissionRequest(type, host, port);
45 } 45 }
46 46
47 bool CanUseSocketAPIs(bool external_plugin, 47 bool CanUseSocketAPIs(bool external_plugin,
48 bool private_api, 48 bool private_api,
49 const SocketPermissionRequest* params, 49 const SocketPermissionRequest* params,
50 int render_process_id, 50 int render_process_id,
51 int render_frame_id) { 51 int render_frame_id) {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 181 }
182 182
183 void OpenUDPFirewallHole(const net::IPEndPoint& address, 183 void OpenUDPFirewallHole(const net::IPEndPoint& address,
184 FirewallHoleOpenCallback callback) { 184 FirewallHoleOpenCallback callback) {
185 OpenFirewallHole(address, chromeos::FirewallHole::PortType::UDP, callback); 185 OpenFirewallHole(address, chromeos::FirewallHole::PortType::UDP, callback);
186 } 186 }
187 #endif // defined(OS_CHROMEOS) 187 #endif // defined(OS_CHROMEOS)
188 188
189 } // namespace pepper_socket_utils 189 } // namespace pepper_socket_utils
190 } // namespace content 190 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698