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

Side by Side Diff: content/renderer/presentation/presentation_dispatcher.cc

Issue 1457963002: Use scoped_ptr instead of linked_ptr from /content/renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android compile error 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 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/renderer/presentation/presentation_dispatcher.h" 5 #include "content/renderer/presentation/presentation_dispatcher.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 const blink::WebString& presentationId, 118 const blink::WebString& presentationId,
119 const blink::WebString& message) { 119 const blink::WebString& message) {
120 if (message.utf8().size() > kMaxPresentationSessionMessageSize) { 120 if (message.utf8().size() > kMaxPresentationSessionMessageSize) {
121 // TODO(crbug.com/459008): Limit the size of individual messages to 64k 121 // TODO(crbug.com/459008): Limit the size of individual messages to 64k
122 // for now. Consider throwing DOMException or splitting bigger messages 122 // for now. Consider throwing DOMException or splitting bigger messages
123 // into smaller chunks later. 123 // into smaller chunks later.
124 LOG(WARNING) << "message size exceeded limit!"; 124 LOG(WARNING) << "message size exceeded limit!";
125 return; 125 return;
126 } 126 }
127 127
128 message_request_queue_.push(make_linked_ptr( 128 message_request_queue_.push(make_scoped_ptr(
129 CreateSendTextMessageRequest(presentationUrl, presentationId, message))); 129 CreateSendTextMessageRequest(presentationUrl, presentationId, message)));
130 // Start processing request if only one in the queue. 130 // Start processing request if only one in the queue.
131 if (message_request_queue_.size() == 1) 131 if (message_request_queue_.size() == 1)
132 DoSendMessage(message_request_queue_.front().get()); 132 DoSendMessage(message_request_queue_.front().get());
133 } 133 }
134 134
135 void PresentationDispatcher::sendArrayBuffer( 135 void PresentationDispatcher::sendArrayBuffer(
136 const blink::WebString& presentationUrl, 136 const blink::WebString& presentationUrl,
137 const blink::WebString& presentationId, 137 const blink::WebString& presentationId,
138 const uint8* data, 138 const uint8* data,
139 size_t length) { 139 size_t length) {
140 DCHECK(data); 140 DCHECK(data);
141 if (length > kMaxPresentationSessionMessageSize) { 141 if (length > kMaxPresentationSessionMessageSize) {
142 // TODO(crbug.com/459008): Same as in sendString(). 142 // TODO(crbug.com/459008): Same as in sendString().
143 LOG(WARNING) << "data size exceeded limit!"; 143 LOG(WARNING) << "data size exceeded limit!";
144 return; 144 return;
145 } 145 }
146 146
147 message_request_queue_.push(make_linked_ptr( 147 message_request_queue_.push(make_scoped_ptr(
148 CreateSendBinaryMessageRequest(presentationUrl, presentationId, 148 CreateSendBinaryMessageRequest(presentationUrl, presentationId,
149 presentation::PresentationMessageType:: 149 presentation::PresentationMessageType::
150 PRESENTATION_MESSAGE_TYPE_ARRAY_BUFFER, 150 PRESENTATION_MESSAGE_TYPE_ARRAY_BUFFER,
151 data, length))); 151 data, length)));
152 // Start processing request if only one in the queue. 152 // Start processing request if only one in the queue.
153 if (message_request_queue_.size() == 1) 153 if (message_request_queue_.size() == 1)
154 DoSendMessage(message_request_queue_.front().get()); 154 DoSendMessage(message_request_queue_.front().get());
155 } 155 }
156 156
157 void PresentationDispatcher::sendBlobData( 157 void PresentationDispatcher::sendBlobData(
158 const blink::WebString& presentationUrl, 158 const blink::WebString& presentationUrl,
159 const blink::WebString& presentationId, 159 const blink::WebString& presentationId,
160 const uint8* data, 160 const uint8* data,
161 size_t length) { 161 size_t length) {
162 DCHECK(data); 162 DCHECK(data);
163 if (length > kMaxPresentationSessionMessageSize) { 163 if (length > kMaxPresentationSessionMessageSize) {
164 // TODO(crbug.com/459008): Same as in sendString(). 164 // TODO(crbug.com/459008): Same as in sendString().
165 LOG(WARNING) << "data size exceeded limit!"; 165 LOG(WARNING) << "data size exceeded limit!";
166 return; 166 return;
167 } 167 }
168 168
169 message_request_queue_.push(make_linked_ptr(CreateSendBinaryMessageRequest( 169 message_request_queue_.push(make_scoped_ptr(CreateSendBinaryMessageRequest(
170 presentationUrl, presentationId, 170 presentationUrl, presentationId,
171 presentation::PresentationMessageType::PRESENTATION_MESSAGE_TYPE_BLOB, 171 presentation::PresentationMessageType::PRESENTATION_MESSAGE_TYPE_BLOB,
172 data, length))); 172 data, length)));
173 // Start processing request if only one in the queue. 173 // Start processing request if only one in the queue.
174 if (message_request_queue_.size() == 1) 174 if (message_request_queue_.size() == 1)
175 DoSendMessage(message_request_queue_.front().get()); 175 DoSendMessage(message_request_queue_.front().get());
176 } 176 }
177 177
178 void PresentationDispatcher::DoSendMessage(SendMessageRequest* request) { 178 void PresentationDispatcher::DoSendMessage(SendMessageRequest* request) {
179 ConnectToPresentationServiceIfNeeded(); 179 ConnectToPresentationServiceIfNeeded();
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus( 492 PresentationDispatcher::AvailabilityStatus::AvailabilityStatus(
493 const std::string& availability_url) 493 const std::string& availability_url)
494 : url(availability_url), 494 : url(availability_url),
495 last_known_availability(false), 495 last_known_availability(false),
496 listening_state(ListeningState::INACTIVE) {} 496 listening_state(ListeningState::INACTIVE) {}
497 497
498 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() { 498 PresentationDispatcher::AvailabilityStatus::~AvailabilityStatus() {
499 } 499 }
500 500
501 } // namespace content 501 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/presentation/presentation_dispatcher.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698