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

Side by Side Diff: ppapi/shared_impl/audio_impl.cc

Issue 6300011: Only close the sync socket if it is non-NULL. This fixes... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "ppapi/shared_impl/audio_impl.h" 5 #include "ppapi/shared_impl/audio_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace pp { 9 namespace pp {
10 namespace shared_impl { 10 namespace shared_impl {
11 11
12 AudioImpl::AudioImpl() 12 AudioImpl::AudioImpl()
13 : playing_(false), 13 : playing_(false),
14 shared_memory_size_(0), 14 shared_memory_size_(0),
15 callback_(NULL), 15 callback_(NULL),
16 user_data_(NULL) { 16 user_data_(NULL) {
17 } 17 }
18 18
19 AudioImpl::~AudioImpl() { 19 AudioImpl::~AudioImpl() {
20 // Closing the socket causes the thread to exit - wait for it. 20 // Closing the socket causes the thread to exit - wait for it.
21 socket_->Close(); 21 if (socket_.get())
22 socket_->Close();
22 if (audio_thread_.get()) { 23 if (audio_thread_.get()) {
23 audio_thread_->Join(); 24 audio_thread_->Join();
24 audio_thread_.reset(); 25 audio_thread_.reset();
25 } 26 }
26 } 27 }
27 28
28 void AudioImpl::SetCallback(PPB_Audio_Callback callback, void* user_data) { 29 void AudioImpl::SetCallback(PPB_Audio_Callback callback, void* user_data) {
29 callback_ = callback; 30 callback_ = callback;
30 user_data_ = user_data; 31 user_data_ = user_data;
31 } 32 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 pending_data >= 0) { 88 pending_data >= 0) {
88 // Exit the thread on pause. 89 // Exit the thread on pause.
89 if (pending_data < 0) 90 if (pending_data < 0)
90 return; 91 return;
91 callback_(buffer, shared_memory_size_, user_data_); 92 callback_(buffer, shared_memory_size_, user_data_);
92 } 93 }
93 } 94 }
94 95
95 } // namespace shared_impl 96 } // namespace shared_impl
96 } // namespace pp 97 } // namespace pp
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698