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

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

Issue 1509063003: Remoting: Remove references to POSIX shared memory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp57_base
Patch Set: Rebase. Created 4 years, 11 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 "remoting/host/desktop_session_proxy.h" 5 #include "remoting/host/desktop_session_proxy.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 size_t size) 53 size_t size)
54 : id_(id), 54 : id_(id),
55 #if defined(OS_WIN) 55 #if defined(OS_WIN)
56 shared_memory_(handle, kReadOnly, process), 56 shared_memory_(handle, kReadOnly, process),
57 #else // !defined(OS_WIN) 57 #else // !defined(OS_WIN)
58 shared_memory_(handle, kReadOnly), 58 shared_memory_(handle, kReadOnly),
59 #endif // !defined(OS_WIN) 59 #endif // !defined(OS_WIN)
60 size_(size) { 60 size_(size) {
61 if (!shared_memory_.Map(size)) { 61 if (!shared_memory_.Map(size)) {
62 LOG(ERROR) << "Failed to map a shared buffer: id=" << id 62 LOG(ERROR) << "Failed to map a shared buffer: id=" << id
63 #if defined(OS_WIN)
64 << ", handle=" << handle.GetHandle()
65 #else
66 << ", handle.fd="
67 << base::SharedMemory::GetFdFromSharedMemoryHandle(handle)
68 #endif
69 << ", size=" << size; 63 << ", size=" << size;
70 } 64 }
71 } 65 }
72 66
73 int id() { return id_; } 67 int id() { return id_; }
74 size_t size() { return size_; } 68 size_t size() { return size_; }
75 void* memory() { return shared_memory_.memory(); } 69 void* memory() { return shared_memory_.memory(); }
76 70
77 private: 71 private:
78 virtual ~IpcSharedBufferCore() {} 72 virtual ~IpcSharedBufferCore() {}
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 } 463 }
470 464
471 // Pass a captured audio packet to |audio_capturer_|. 465 // Pass a captured audio packet to |audio_capturer_|.
472 audio_capture_task_runner_->PostTask( 466 audio_capture_task_runner_->PostTask(
473 FROM_HERE, base::Bind(&IpcAudioCapturer::OnAudioPacket, audio_capturer_, 467 FROM_HERE, base::Bind(&IpcAudioCapturer::OnAudioPacket, audio_capturer_,
474 base::Passed(&packet))); 468 base::Passed(&packet)));
475 } 469 }
476 470
477 void DesktopSessionProxy::OnCreateSharedBuffer( 471 void DesktopSessionProxy::OnCreateSharedBuffer(
478 int id, 472 int id,
479 IPC::PlatformFileForTransit handle, 473 base::SharedMemoryHandle handle,
480 uint32_t size) { 474 uint32_t size) {
481 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 475 DCHECK(caller_task_runner_->BelongsToCurrentThread());
482 476
483 #if defined(OS_WIN)
484 base::SharedMemoryHandle shm_handle =
485 base::SharedMemoryHandle(handle, base::GetCurrentProcId());
486 #else
487 base::SharedMemoryHandle shm_handle = base::SharedMemoryHandle(handle);
488 #endif
489 scoped_refptr<IpcSharedBufferCore> shared_buffer = 477 scoped_refptr<IpcSharedBufferCore> shared_buffer =
490 new IpcSharedBufferCore(id, shm_handle, desktop_process_.Handle(), size); 478 new IpcSharedBufferCore(id, handle, desktop_process_.Handle(), size);
491 479
492 if (shared_buffer->memory() != nullptr && 480 if (shared_buffer->memory() != nullptr &&
493 !shared_buffers_.insert(std::make_pair(id, shared_buffer)).second) { 481 !shared_buffers_.insert(std::make_pair(id, shared_buffer)).second) {
494 LOG(ERROR) << "Duplicate shared buffer id " << id << " encountered"; 482 LOG(ERROR) << "Duplicate shared buffer id " << id << " encountered";
495 } 483 }
496 } 484 }
497 485
498 void DesktopSessionProxy::OnReleaseSharedBuffer(int id) { 486 void DesktopSessionProxy::OnReleaseSharedBuffer(int id) {
499 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 487 DCHECK(caller_task_runner_->BelongsToCurrentThread());
500 488
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 } 567 }
580 568
581 // static 569 // static
582 void DesktopSessionProxyTraits::Destruct( 570 void DesktopSessionProxyTraits::Destruct(
583 const DesktopSessionProxy* desktop_session_proxy) { 571 const DesktopSessionProxy* desktop_session_proxy) {
584 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, 572 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE,
585 desktop_session_proxy); 573 desktop_session_proxy);
586 } 574 }
587 575
588 } // namespace remoting 576 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/desktop_session_proxy.h ('k') | remoting/host/ipc_desktop_environment_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698