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

Side by Side Diff: remoting/host/linux/audio_pipe_reader.cc

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 "remoting/host/linux/audio_pipe_reader.h" 5 #include "remoting/host/linux/audio_pipe_reader.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 29 matching lines...) Expand all
40 // F_SETPIPE_SZ is supported only starting linux 2.6.35, but we want to be able 40 // F_SETPIPE_SZ is supported only starting linux 2.6.35, but we want to be able
41 // to compile this code on machines with older kernel. 41 // to compile this code on machines with older kernel.
42 #define F_SETPIPE_SZ 1031 42 #define F_SETPIPE_SZ 1031
43 #endif // defined(F_SETPIPE_SZ) 43 #endif // defined(F_SETPIPE_SZ)
44 44
45 } // namespace 45 } // namespace
46 46
47 // static 47 // static
48 scoped_refptr<AudioPipeReader> AudioPipeReader::Create( 48 scoped_refptr<AudioPipeReader> AudioPipeReader::Create(
49 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 49 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
50 const FilePath& pipe_name) { 50 const base::FilePath& pipe_name) {
51 // Create a reference to the new AudioPipeReader before posting the 51 // Create a reference to the new AudioPipeReader before posting the
52 // StartOnAudioThread task, otherwise it may be deleted on the audio 52 // StartOnAudioThread task, otherwise it may be deleted on the audio
53 // thread before we return. 53 // thread before we return.
54 scoped_refptr<AudioPipeReader> pipe_reader = 54 scoped_refptr<AudioPipeReader> pipe_reader =
55 new AudioPipeReader(task_runner); 55 new AudioPipeReader(task_runner);
56 task_runner->PostTask(FROM_HERE, base::Bind( 56 task_runner->PostTask(FROM_HERE, base::Bind(
57 &AudioPipeReader::StartOnAudioThread, pipe_reader, pipe_name)); 57 &AudioPipeReader::StartOnAudioThread, pipe_reader, pipe_name));
58 return pipe_reader; 58 return pipe_reader;
59 } 59 }
60 60
61 void AudioPipeReader::StartOnAudioThread(const FilePath& pipe_name) { 61 void AudioPipeReader::StartOnAudioThread(const base::FilePath& pipe_name) {
62 DCHECK(task_runner_->BelongsToCurrentThread()); 62 DCHECK(task_runner_->BelongsToCurrentThread());
63 63
64 pipe_fd_ = HANDLE_EINTR(open( 64 pipe_fd_ = HANDLE_EINTR(open(
65 pipe_name.value().c_str(), O_RDONLY | O_NONBLOCK)); 65 pipe_name.value().c_str(), O_RDONLY | O_NONBLOCK));
66 if (pipe_fd_ < 0) { 66 if (pipe_fd_ < 0) {
67 LOG(ERROR) << "Failed to open " << pipe_name.value(); 67 LOG(ERROR) << "Failed to open " << pipe_name.value();
68 return; 68 return;
69 } 69 }
70 70
71 // Set buffer size for the pipe. 71 // Set buffer size for the pipe.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 pipe_fd_, false, MessageLoopForIO::WATCH_READ, 174 pipe_fd_, false, MessageLoopForIO::WATCH_READ,
175 &file_descriptor_watcher_, this); 175 &file_descriptor_watcher_, this);
176 } 176 }
177 177
178 // static 178 // static
179 void AudioPipeReaderTraits::Destruct(const AudioPipeReader* audio_pipe_reader) { 179 void AudioPipeReaderTraits::Destruct(const AudioPipeReader* audio_pipe_reader) {
180 audio_pipe_reader->task_runner_->DeleteSoon(FROM_HERE, audio_pipe_reader); 180 audio_pipe_reader->task_runner_->DeleteSoon(FROM_HERE, audio_pipe_reader);
181 } 181 }
182 182
183 } // namespace remoting 183 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/linux/audio_pipe_reader.h ('k') | remoting/host/policy_hack/policy_watcher_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698