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

Side by Side Diff: chrome/browser/speech/tts_linux.cc

Issue 172103004: Run SPD in a single-threaded mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 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
« 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) 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 <math.h> 5 #include <math.h>
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/debug/leak_annotations.h" 9 #include "base/debug/leak_annotations.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 base::AutoLock lock(initialization_lock_); 103 base::AutoLock lock(initialization_lock_);
104 104
105 if (!libspeechd_loader_.Load("libspeechd.so.2")) 105 if (!libspeechd_loader_.Load("libspeechd.so.2"))
106 return; 106 return;
107 107
108 { 108 {
109 // spd_open has memory leaks which are hard to suppress. 109 // spd_open has memory leaks which are hard to suppress.
110 // http://crbug.com/317360 110 // http://crbug.com/317360
111 ANNOTATE_SCOPED_MEMORY_LEAK; 111 ANNOTATE_SCOPED_MEMORY_LEAK;
112 conn_ = libspeechd_loader_.spd_open( 112 conn_ = libspeechd_loader_.spd_open(
113 "chrome", "extension_api", NULL, SPD_MODE_THREADED); 113 "chrome", "extension_api", NULL, SPD_MODE_SINGLE);
114 } 114 }
115 if (!conn_) 115 if (!conn_)
116 return; 116 return;
117 117
118 // Register callbacks for all events. 118 // Register callbacks for all events.
119 conn_->callback_begin = 119 conn_->callback_begin =
120 conn_->callback_end = 120 conn_->callback_end =
121 conn_->callback_cancel = 121 conn_->callback_cancel =
122 conn_->callback_pause = 122 conn_->callback_pause =
123 conn_->callback_resume = 123 conn_->callback_resume =
(...skipping 14 matching lines...) Expand all
138 libspeechd_loader_.spd_close(conn_); 138 libspeechd_loader_.spd_close(conn_);
139 conn_ = NULL; 139 conn_ = NULL;
140 } 140 }
141 } 141 }
142 142
143 void TtsPlatformImplLinux::Reset() { 143 void TtsPlatformImplLinux::Reset() {
144 base::AutoLock lock(initialization_lock_); 144 base::AutoLock lock(initialization_lock_);
145 if (conn_) 145 if (conn_)
146 libspeechd_loader_.spd_close(conn_); 146 libspeechd_loader_.spd_close(conn_);
147 conn_ = libspeechd_loader_.spd_open( 147 conn_ = libspeechd_loader_.spd_open(
148 "chrome", "extension_api", NULL, SPD_MODE_THREADED); 148 "chrome", "extension_api", NULL, SPD_MODE_SINGLE);
149 } 149 }
150 150
151 bool TtsPlatformImplLinux::PlatformImplAvailable() { 151 bool TtsPlatformImplLinux::PlatformImplAvailable() {
152 if (!initialization_lock_.Try()) 152 if (!initialization_lock_.Try())
153 return false; 153 return false;
154 bool result = libspeechd_loader_.loaded() && (conn_ != NULL); 154 bool result = libspeechd_loader_.loaded() && (conn_ != NULL);
155 initialization_lock_.Release(); 155 initialization_lock_.Release();
156 return result; 156 return result;
157 } 157 }
158 158
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 // static 337 // static
338 TtsPlatformImplLinux* TtsPlatformImplLinux::GetInstance() { 338 TtsPlatformImplLinux* TtsPlatformImplLinux::GetInstance() {
339 return Singleton<TtsPlatformImplLinux, 339 return Singleton<TtsPlatformImplLinux,
340 LeakySingletonTraits<TtsPlatformImplLinux> >::get(); 340 LeakySingletonTraits<TtsPlatformImplLinux> >::get();
341 } 341 }
342 342
343 // static 343 // static
344 TtsPlatformImpl* TtsPlatformImpl::GetInstance() { 344 TtsPlatformImpl* TtsPlatformImpl::GetInstance() {
345 return TtsPlatformImplLinux::GetInstance(); 345 return TtsPlatformImplLinux::GetInstance();
346 } 346 }
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