summaryrefslogtreecommitdiffstats
path: root/content/browser/speech
diff options
context:
space:
mode:
authorleandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-17 10:18:39 +0000
committerleandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-17 10:18:39 +0000
commit480e650681a7ac8169ceaefa52b327e6d4de568d (patch)
tree3796c076c8f2df73c3a2763840e274a9dfac1e85 /content/browser/speech
parent2f959a6cc2951c097e9b0e39d260e72b7b97984e (diff)
downloadchromium_src-480e650681a7ac8169ceaefa52b327e6d4de568d.zip
chromium_src-480e650681a7ac8169ceaefa52b327e6d4de568d.tar.gz
chromium_src-480e650681a7ac8169ceaefa52b327e6d4de568d.tar.bz2
Migrating NewRunnableMethod/Function to bind::Base in the speech input code.
BUG=61677 TEST=none Review URL: http://codereview.chromium.org/8289007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105788 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/speech')
-rw-r--r--content/browser/speech/speech_input_browsertest.cc17
-rw-r--r--content/browser/speech/speech_input_manager.cc3
-rw-r--r--content/browser/speech/speech_recognizer.cc11
3 files changed, 16 insertions, 15 deletions
diff --git a/content/browser/speech/speech_input_browsertest.cc b/content/browser/speech/speech_input_browsertest.cc
index 4af042f..66a402f 100644
--- a/content/browser/speech/speech_input_browsertest.cc
+++ b/content/browser/speech/speech_input_browsertest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/string_number_conversions.h"
@@ -20,12 +21,6 @@ namespace speech_input {
class FakeSpeechInputManager;
}
-// This class does not need to be refcounted (typically done by PostTask) since
-// it will outlive the test and gets released only when the test shuts down.
-// Disabling refcounting here saves a bit of unnecessary code and the factory
-// method can return a plain pointer below as required by the real code.
-DISABLE_RUNNABLE_METHOD_REFCOUNT(speech_input::FakeSpeechInputManager);
-
namespace speech_input {
const char* kTestResult = "Pictures of the moon";
@@ -70,8 +65,14 @@ class FakeSpeechInputManager : public SpeechInputManager {
grammar_ = grammar;
if (send_fake_response_) {
// Give the fake result in a short while.
- MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(this,
- &FakeSpeechInputManager::SetFakeRecognitionResult));
+ MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
+ &FakeSpeechInputManager::SetFakeRecognitionResult,
+ // This class does not need to be refcounted (typically done by
+ // PostTask) since it will outlive the test and gets released only
+ // when the test shuts down. Disabling refcounting here saves a bit
+ // of unnecessary code and the factory method can return a plain
+ // pointer below as required by the real code.
+ base::Unretained(this)));
}
}
virtual void CancelRecognition(int caller_id) {
diff --git a/content/browser/speech/speech_input_manager.cc b/content/browser/speech/speech_input_manager.cc
index 2f29f77..87b7627 100644
--- a/content/browser/speech/speech_input_manager.cc
+++ b/content/browser/speech/speech_input_manager.cc
@@ -4,6 +4,7 @@
#include "content/browser/speech/speech_input_manager.h"
+#include "base/bind.h"
#include "content/browser/browser_thread.h"
#include "content/browser/speech/speech_input_preferences.h"
#include "media/audio/audio_manager.h"
@@ -35,7 +36,7 @@ void SpeechInputManager::ShowAudioInputSettings() {
if (!BrowserThread::CurrentlyOn(BrowserThread::FILE)) {
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
- NewRunnableFunction(&SpeechInputManager::ShowAudioInputSettings));
+ base::Bind(&SpeechInputManager::ShowAudioInputSettings));
return;
}
diff --git a/content/browser/speech/speech_recognizer.cc b/content/browser/speech/speech_recognizer.cc
index a54c10f..f045e6f 100644
--- a/content/browser/speech/speech_recognizer.cc
+++ b/content/browser/speech/speech_recognizer.cc
@@ -4,6 +4,7 @@
#include "content/browser/speech/speech_recognizer.h"
+#include "base/bind.h"
#include "base/time.h"
#include "content/browser/browser_thread.h"
#include "net/url_request/url_request_context_getter.h"
@@ -173,9 +174,8 @@ void SpeechRecognizer::StopRecording() {
void SpeechRecognizer::OnError(AudioInputController* controller,
int error_code) {
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(this,
- &SpeechRecognizer::HandleOnError,
- error_code));
+ base::Bind(&SpeechRecognizer::HandleOnError,
+ this, error_code));
}
void SpeechRecognizer::HandleOnError(int error_code) {
@@ -197,9 +197,8 @@ void SpeechRecognizer::OnData(AudioInputController* controller,
string* str_data = new string(reinterpret_cast<const char*>(data), size);
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(this,
- &SpeechRecognizer::HandleOnData,
- str_data));
+ base::Bind(&SpeechRecognizer::HandleOnData,
+ this, str_data));
}
void SpeechRecognizer::HandleOnData(string* data) {