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

Side by Side Diff: content/browser/renderer_host/media/audio_input_sync_writer.cc

Issue 12537014: Make SharedMemory track the size that was actually mapped (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
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 "content/browser/renderer_host/media/audio_input_sync_writer.h" 5 #include "content/browser/renderer_host/media/audio_input_sync_writer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 AudioInputSyncWriter::AudioInputSyncWriter( 14 AudioInputSyncWriter::AudioInputSyncWriter(
15 base::SharedMemory* shared_memory, 15 base::SharedMemory* shared_memory,
16 int shared_memory_segment_count) 16 int shared_memory_segment_count)
17 : shared_memory_(shared_memory), 17 : shared_memory_(shared_memory),
18 shared_memory_segment_count_(shared_memory_segment_count), 18 shared_memory_segment_count_(shared_memory_segment_count),
19 current_segment_id_(0) { 19 current_segment_id_(0) {
20 DCHECK_GT(shared_memory_segment_count, 0); 20 DCHECK_GT(shared_memory_segment_count, 0);
21 DCHECK_EQ(shared_memory->created_size() % shared_memory_segment_count, 0u); 21 DCHECK_EQ(shared_memory->requested_size() % shared_memory_segment_count, 0u);
22 shared_memory_segment_size_ = 22 shared_memory_segment_size_ =
23 shared_memory->created_size() / shared_memory_segment_count; 23 shared_memory->requested_size() / shared_memory_segment_count;
24 } 24 }
25 25
26 AudioInputSyncWriter::~AudioInputSyncWriter() {} 26 AudioInputSyncWriter::~AudioInputSyncWriter() {}
27 27
28 // TODO(henrika): Combine into one method (including Write). 28 // TODO(henrika): Combine into one method (including Write).
29 void AudioInputSyncWriter::UpdateRecordedBytes(uint32 bytes) { 29 void AudioInputSyncWriter::UpdateRecordedBytes(uint32 bytes) {
30 socket_->Send(&bytes, sizeof(bytes)); 30 socket_->Send(&bytes, sizeof(bytes));
31 } 31 }
32 32
33 uint32 AudioInputSyncWriter::Write( 33 uint32 AudioInputSyncWriter::Write(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 base::ProcessHandle process_handle, 74 base::ProcessHandle process_handle,
75 base::FileDescriptor* foreign_handle) { 75 base::FileDescriptor* foreign_handle) {
76 foreign_handle->fd = foreign_socket_->handle(); 76 foreign_handle->fd = foreign_socket_->handle();
77 foreign_handle->auto_close = false; 77 foreign_handle->auto_close = false;
78 return (foreign_handle->fd != -1); 78 return (foreign_handle->fd != -1);
79 } 79 }
80 80
81 #endif 81 #endif
82 82
83 } // namespace content 83 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698