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

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

Issue 1134223003: RunSpeech Dispatcher in multi threaded mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« 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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/leak_annotations.h" 10 #include "base/debug/leak_annotations.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 base::AutoLock lock(initialization_lock_); 109 base::AutoLock lock(initialization_lock_);
110 110
111 if (!libspeechd_loader_.Load("libspeechd.so.2")) 111 if (!libspeechd_loader_.Load("libspeechd.so.2"))
112 return; 112 return;
113 113
114 { 114 {
115 // spd_open has memory leaks which are hard to suppress. 115 // spd_open has memory leaks which are hard to suppress.
116 // http://crbug.com/317360 116 // http://crbug.com/317360
117 ANNOTATE_SCOPED_MEMORY_LEAK; 117 ANNOTATE_SCOPED_MEMORY_LEAK;
118 conn_ = libspeechd_loader_.spd_open( 118 conn_ = libspeechd_loader_.spd_open(
119 "chrome", "extension_api", NULL, SPD_MODE_SINGLE); 119 "chrome", "extension_api", NULL, SPD_MODE_THREADED);
120 } 120 }
121 if (!conn_) 121 if (!conn_)
122 return; 122 return;
123 123
124 // Register callbacks for all events. 124 // Register callbacks for all events.
125 conn_->callback_begin = 125 conn_->callback_begin =
126 conn_->callback_end = 126 conn_->callback_end =
127 conn_->callback_cancel = 127 conn_->callback_cancel =
128 conn_->callback_pause = 128 conn_->callback_pause =
129 conn_->callback_resume = 129 conn_->callback_resume =
(...skipping 14 matching lines...) Expand all
144 libspeechd_loader_.spd_close(conn_); 144 libspeechd_loader_.spd_close(conn_);
145 conn_ = NULL; 145 conn_ = NULL;
146 } 146 }
147 } 147 }
148 148
149 void TtsPlatformImplLinux::Reset() { 149 void TtsPlatformImplLinux::Reset() {
150 base::AutoLock lock(initialization_lock_); 150 base::AutoLock lock(initialization_lock_);
151 if (conn_) 151 if (conn_)
152 libspeechd_loader_.spd_close(conn_); 152 libspeechd_loader_.spd_close(conn_);
153 conn_ = libspeechd_loader_.spd_open( 153 conn_ = libspeechd_loader_.spd_open(
154 "chrome", "extension_api", NULL, SPD_MODE_SINGLE); 154 "chrome", "extension_api", NULL, SPD_MODE_THREADED);
155 } 155 }
156 156
157 bool TtsPlatformImplLinux::PlatformImplAvailable() { 157 bool TtsPlatformImplLinux::PlatformImplAvailable() {
158 if (!initialization_lock_.Try()) 158 if (!initialization_lock_.Try())
159 return false; 159 return false;
160 bool result = libspeechd_loader_.loaded() && (conn_ != NULL); 160 bool result = libspeechd_loader_.loaded() && (conn_ != NULL);
161 initialization_lock_.Release(); 161 initialization_lock_.Release();
162 return result; 162 return result;
163 } 163 }
164 164
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 // static 347 // static
348 TtsPlatformImplLinux* TtsPlatformImplLinux::GetInstance() { 348 TtsPlatformImplLinux* TtsPlatformImplLinux::GetInstance() {
349 return Singleton<TtsPlatformImplLinux, 349 return Singleton<TtsPlatformImplLinux,
350 LeakySingletonTraits<TtsPlatformImplLinux> >::get(); 350 LeakySingletonTraits<TtsPlatformImplLinux> >::get();
351 } 351 }
352 352
353 // static 353 // static
354 TtsPlatformImpl* TtsPlatformImpl::GetInstance() { 354 TtsPlatformImpl* TtsPlatformImpl::GetInstance() {
355 return TtsPlatformImplLinux::GetInstance(); 355 return TtsPlatformImplLinux::GetInstance();
356 } 356 }
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