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

Side by Side Diff: remoting/host/desktop_session_agent.cc

Issue 1996753002: Fix DesktopSessioAgent crash when handling nullptr OnCaptureCompleted callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Share two --pending_capture_frame_requests_ calls Created 4 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
« no previous file with comments | « remoting/host/desktop_session_agent.h ('k') | remoting/host/desktop_session_proxy.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) 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 "remoting/host/desktop_session_agent.h" 5 #include "remoting/host/desktop_session_agent.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 base::Bind(&DesktopSessionAgent::SendToNetwork, this)))); 319 base::Bind(&DesktopSessionAgent::SendToNetwork, this))));
320 mouse_cursor_monitor_ = desktop_environment_->CreateMouseCursorMonitor(); 320 mouse_cursor_monitor_ = desktop_environment_->CreateMouseCursorMonitor();
321 mouse_cursor_monitor_->Init(this, webrtc::MouseCursorMonitor::SHAPE_ONLY); 321 mouse_cursor_monitor_->Init(this, webrtc::MouseCursorMonitor::SHAPE_ONLY);
322 } 322 }
323 323
324 void DesktopSessionAgent::OnCaptureCompleted(webrtc::DesktopFrame* frame) { 324 void DesktopSessionAgent::OnCaptureCompleted(webrtc::DesktopFrame* frame) {
325 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 325 DCHECK(caller_task_runner_->BelongsToCurrentThread());
326 326
327 last_frame_.reset(frame); 327 last_frame_.reset(frame);
328 328
329 current_size_ = frame->size();
330
331 // Serialize webrtc::DesktopFrame. 329 // Serialize webrtc::DesktopFrame.
332 SerializedDesktopFrame serialized_frame; 330 SerializedDesktopFrame serialized_frame;
333 serialized_frame.shared_buffer_id = frame->shared_memory()->id(); 331 if (frame) {
334 serialized_frame.bytes_per_row = frame->stride(); 332 serialized_frame.shared_buffer_id = frame->shared_memory()->id();
335 serialized_frame.dimensions = frame->size(); 333 serialized_frame.bytes_per_row = frame->stride();
336 serialized_frame.capture_time_ms = frame->capture_time_ms(); 334 serialized_frame.dimensions = frame->size();
337 serialized_frame.dpi = frame->dpi(); 335 serialized_frame.capture_time_ms = frame->capture_time_ms();
338 for (webrtc::DesktopRegion::Iterator i(frame->updated_region()); 336 serialized_frame.dpi = frame->dpi();
339 !i.IsAtEnd(); i.Advance()) { 337 for (webrtc::DesktopRegion::Iterator i(frame->updated_region());
340 serialized_frame.dirty_region.push_back(i.rect()); 338 !i.IsAtEnd(); i.Advance()) {
339 serialized_frame.dirty_region.push_back(i.rect());
340 }
341 } 341 }
342 342
343 SendToNetwork(base::WrapUnique( 343 SendToNetwork(base::WrapUnique(
344 new ChromotingDesktopNetworkMsg_CaptureCompleted(serialized_frame))); 344 new ChromotingDesktopNetworkMsg_CaptureCompleted(serialized_frame)));
345 } 345 }
346 346
347 void DesktopSessionAgent::OnMouseCursor(webrtc::MouseCursor* cursor) { 347 void DesktopSessionAgent::OnMouseCursor(webrtc::MouseCursor* cursor) {
348 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 348 DCHECK(caller_task_runner_->BelongsToCurrentThread());
349 349
350 std::unique_ptr<webrtc::MouseCursor> owned_cursor(cursor); 350 std::unique_ptr<webrtc::MouseCursor> owned_cursor(cursor);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 } 578 }
579 } 579 }
580 580
581 void DesktopSessionAgent::StopAudioCapturer() { 581 void DesktopSessionAgent::StopAudioCapturer() {
582 DCHECK(audio_capture_task_runner_->BelongsToCurrentThread()); 582 DCHECK(audio_capture_task_runner_->BelongsToCurrentThread());
583 583
584 audio_capturer_.reset(); 584 audio_capturer_.reset();
585 } 585 }
586 586
587 } // namespace remoting 587 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/desktop_session_agent.h ('k') | remoting/host/desktop_session_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698