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

Side by Side Diff: content/child/webmessageportchannel_impl.cc

Issue 2799563002: Replace usage of WebVector::isEmpty with WebVector::empty().
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | content/renderer/media/media_stream_renderer_factory_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/webmessageportchannel_impl.h" 5 #include "content/child/webmessageportchannel_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 base::Unretained(client))); 93 base::Unretained(client)));
94 } else { 94 } else {
95 port_.ClearCallback(); 95 port_.ClearCallback();
96 } 96 }
97 } 97 }
98 98
99 void WebMessagePortChannelImpl::postMessage( 99 void WebMessagePortChannelImpl::postMessage(
100 const WebString& encoded_message, 100 const WebString& encoded_message,
101 WebMessagePortChannelArray channels) { 101 WebMessagePortChannelArray channels) {
102 std::vector<MessagePort> ports; 102 std::vector<MessagePort> ports;
103 if (!channels.isEmpty()) { 103 if (!channels.empty()) {
104 ports.resize(channels.size()); 104 ports.resize(channels.size());
105 for (size_t i = 0; i < channels.size(); ++i) { 105 for (size_t i = 0; i < channels.size(); ++i) {
106 ports[i] = static_cast<WebMessagePortChannelImpl*>(channels[i].get())-> 106 ports[i] = static_cast<WebMessagePortChannelImpl*>(channels[i].get())->
107 ReleaseMessagePort(); 107 ReleaseMessagePort();
108 } 108 }
109 } 109 }
110 port_.PostMessage(encoded_message.utf16(), std::move(ports)); 110 port_.PostMessage(encoded_message.utf16(), std::move(ports));
111 } 111 }
112 112
113 bool WebMessagePortChannelImpl::tryGetMessage( 113 bool WebMessagePortChannelImpl::tryGetMessage(
114 WebString* encoded_message, 114 WebString* encoded_message,
115 WebMessagePortChannelArray& channels) { 115 WebMessagePortChannelArray& channels) {
116 base::string16 buffer; 116 base::string16 buffer;
117 std::vector<MessagePort> ports; 117 std::vector<MessagePort> ports;
118 if (!port_.GetMessage(&buffer, &ports)) 118 if (!port_.GetMessage(&buffer, &ports))
119 return false; 119 return false;
120 120
121 *encoded_message = WebString::fromUTF16(buffer); 121 *encoded_message = WebString::fromUTF16(buffer);
122 122
123 if (!ports.empty()) { 123 if (!ports.empty()) {
124 channels = WebMessagePortChannelArray(ports.size()); 124 channels = WebMessagePortChannelArray(ports.size());
125 for (size_t i = 0; i < ports.size(); ++i) 125 for (size_t i = 0; i < ports.size(); ++i)
126 channels[i] = base::MakeUnique<WebMessagePortChannelImpl>(ports[i]); 126 channels[i] = base::MakeUnique<WebMessagePortChannelImpl>(ports[i]);
127 } 127 }
128 return true; 128 return true;
129 } 129 }
130 130
131 } // namespace content 131 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/media_stream_renderer_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698