| Index: media/audio/fake_audio_consumer.h
 | 
| diff --git a/media/audio/fake_audio_consumer.h b/media/audio/fake_audio_consumer.h
 | 
| index 57da74fabfffaf0b090c1f8861052128b03116e4..36b4030b1903c00dd73e450cf410ec9932f37dbf 100644
 | 
| --- a/media/audio/fake_audio_consumer.h
 | 
| +++ b/media/audio/fake_audio_consumer.h
 | 
| @@ -5,10 +5,9 @@
 | 
|  #ifndef MEDIA_AUDIO_FAKE_AUDIO_CONSUMER_H_
 | 
|  #define MEDIA_AUDIO_FAKE_AUDIO_CONSUMER_H_
 | 
|  
 | 
| -#include "base/cancelable_callback.h"
 | 
| -#include "base/memory/scoped_ptr.h"
 | 
| -#include "base/time.h"
 | 
| -#include "media/audio/audio_parameters.h"
 | 
| +#include "base/callback_forward.h"
 | 
| +#include "base/memory/ref_counted.h"
 | 
| +#include "media/base/media_export.h"
 | 
|  
 | 
|  namespace base {
 | 
|  class MessageLoopProxy;
 | 
| @@ -16,42 +15,35 @@ class MessageLoopProxy;
 | 
|  
 | 
|  namespace media {
 | 
|  class AudioBus;
 | 
| +class AudioParameters;
 | 
|  
 | 
|  // A fake audio consumer.  Using a provided message loop, FakeAudioConsumer will
 | 
|  // simulate a real time consumer of audio data.
 | 
|  class MEDIA_EXPORT FakeAudioConsumer {
 | 
|   public:
 | 
| -  // |message_loop| is the loop on which the ReadCB provided to Start() will be
 | 
| -  // executed on.  |params| is used to determine the frequency of callbacks.
 | 
| -  FakeAudioConsumer(const scoped_refptr<base::MessageLoopProxy>& message_loop,
 | 
| +  // |worker_loop| is the loop on which the ReadCB provided to Start() will be
 | 
| +  // executed on.  This may or may not be the be for the same thread that
 | 
| +  // invokes the Start/Stop methods.
 | 
| +  // |params| is used to determine the frequency of callbacks.
 | 
| +  FakeAudioConsumer(const scoped_refptr<base::MessageLoopProxy>& worker_loop,
 | 
|                      const AudioParameters& params);
 | 
|    ~FakeAudioConsumer();
 | 
|  
 | 
| -  // Start executing |read_cb| at a regular interval.  Must be called on the
 | 
| -  // message loop provided during construction.  Stop() must be called before
 | 
| -  // destroying FakeAudioConsumer.
 | 
| +  // Start executing |read_cb| at a regular intervals.  Stop() must be called by
 | 
| +  // the same thread before destroying FakeAudioConsumer.
 | 
|    typedef base::Callback<void(AudioBus* audio_bus)> ReadCB;
 | 
|    void Start(const ReadCB& read_cb);
 | 
|  
 | 
| -  // Stop executing the ReadCB provided to Start().  Cancels any outstanding
 | 
| -  // callbacks.  Safe to call multiple times.  Must be called on the message
 | 
| -  // loop provided during construction.
 | 
| +  // Stop executing the ReadCB provided to Start().  Blocks until the worker
 | 
| +  // loop is not inside a ReadCB invocation.  Safe to call multiple times.  Must
 | 
| +  // be called on the same thread that called Start().
 | 
|    void Stop();
 | 
|  
 | 
|   private:
 | 
| -  // Task that regularly calls |read_cb_| according to the playback rate as
 | 
| -  // determined by the audio parameters given during construction.  Runs on
 | 
| -  // |message_loop_|.
 | 
| -  void DoRead();
 | 
| -
 | 
| -  scoped_refptr<base::MessageLoopProxy> message_loop_;
 | 
| -  ReadCB read_cb_;
 | 
| -  scoped_ptr<AudioBus> audio_bus_;
 | 
| -  base::TimeDelta buffer_duration_;
 | 
| -  base::TimeTicks next_read_time_;
 | 
| -
 | 
| -  // Used to post delayed tasks to the AudioThread that we can cancel.
 | 
| -  base::CancelableClosure read_task_cb_;
 | 
| +  // All state and implementation is kept within this class because it must hang
 | 
| +  // around until tasks posted on |worker_loop| have all run (or been canceled).
 | 
| +  class Worker;
 | 
| +  Worker* const worker_;
 | 
|  
 | 
|    DISALLOW_COPY_AND_ASSIGN(FakeAudioConsumer);
 | 
|  };
 | 
| 
 |