OLD | NEW |
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 "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 << ", handle.fd=" | 60 << ", handle.fd=" |
61 << base::SharedMemory::GetFdFromSharedMemoryHandle(handle) | 61 << base::SharedMemory::GetFdFromSharedMemoryHandle(handle) |
62 #endif | 62 #endif |
63 << ", size=" << size; | 63 << ", size=" << size; |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 int id() { return id_; } | 67 int id() { return id_; } |
68 size_t size() { return size_; } | 68 size_t size() { return size_; } |
69 void* memory() { return shared_memory_.memory(); } | 69 void* memory() { return shared_memory_.memory(); } |
70 webrtc::SharedMemory::Handle handle() { | |
71 #if defined(OS_WIN) | |
72 return shared_memory_.handle().GetHandle(); | |
73 #else | |
74 return base::SharedMemory::GetFdFromSharedMemoryHandle( | |
75 shared_memory_.handle()); | |
76 #endif | |
77 } | |
78 | 70 |
79 private: | 71 private: |
80 virtual ~IpcSharedBufferCore() {} | 72 virtual ~IpcSharedBufferCore() {} |
81 friend class base::RefCountedThreadSafe<IpcSharedBufferCore>; | 73 friend class base::RefCountedThreadSafe<IpcSharedBufferCore>; |
82 | 74 |
83 int id_; | 75 int id_; |
84 base::SharedMemory shared_memory_; | 76 base::SharedMemory shared_memory_; |
85 size_t size_; | 77 size_t size_; |
86 | 78 |
87 DISALLOW_COPY_AND_ASSIGN(IpcSharedBufferCore); | 79 DISALLOW_COPY_AND_ASSIGN(IpcSharedBufferCore); |
88 }; | 80 }; |
89 | 81 |
90 class DesktopSessionProxy::IpcSharedBuffer : public webrtc::SharedMemory { | 82 class DesktopSessionProxy::IpcSharedBuffer : public webrtc::SharedMemory { |
91 public: | 83 public: |
92 IpcSharedBuffer(scoped_refptr<IpcSharedBufferCore> core) | 84 IpcSharedBuffer(scoped_refptr<IpcSharedBufferCore> core) |
93 : SharedMemory(core->memory(), core->size(), | 85 : SharedMemory(core->memory(), core->size(), 0, core->id()), |
94 core->handle(), core->id()), | 86 core_(core) {} |
95 core_(core) { | |
96 } | |
97 | 87 |
98 private: | 88 private: |
99 scoped_refptr<IpcSharedBufferCore> core_; | 89 scoped_refptr<IpcSharedBufferCore> core_; |
100 | 90 |
101 DISALLOW_COPY_AND_ASSIGN(IpcSharedBuffer); | 91 DISALLOW_COPY_AND_ASSIGN(IpcSharedBuffer); |
102 }; | 92 }; |
103 | 93 |
104 DesktopSessionProxy::DesktopSessionProxy( | 94 DesktopSessionProxy::DesktopSessionProxy( |
105 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner, | 95 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner, |
106 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 96 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 } | 573 } |
584 | 574 |
585 // static | 575 // static |
586 void DesktopSessionProxyTraits::Destruct( | 576 void DesktopSessionProxyTraits::Destruct( |
587 const DesktopSessionProxy* desktop_session_proxy) { | 577 const DesktopSessionProxy* desktop_session_proxy) { |
588 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, | 578 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, |
589 desktop_session_proxy); | 579 desktop_session_proxy); |
590 } | 580 } |
591 | 581 |
592 } // namespace remoting | 582 } // namespace remoting |
OLD | NEW |