| OLD | NEW | 
| (Empty) |  | 
 |   1 // Copyright 2016 The Chromium Authors. All rights reserved. | 
 |   2 // Use of this source code is governed by a BSD-style license that can be | 
 |   3 // found in the LICENSE file. | 
 |   4  | 
 |   5 #include "media/base/state_machine.h" | 
 |   6  | 
 |   7 namespace media { | 
 |   8  | 
 |   9 StateMachine::StateMachine() : owner_(nullptr) {} | 
 |  10  | 
 |  11 StateMachine::~StateMachine() { | 
 |  12   for (scoped_refptr<State> state : states_) | 
 |  13     state->UnregisterClient(this); | 
 |  14 } | 
 |  15  | 
 |  16 void StateMachine::SetOwner(Owner* owner) { | 
 |  17   owner_ = owner; | 
 |  18 } | 
 |  19  | 
 |  20 void StateMachine::OnStateChanged() { | 
 |  21   DCHECK(owner_); | 
 |  22   owner_->RequestRun(this); | 
 |  23 } | 
 |  24  | 
 |  25 void StateMachine::UsingState(scoped_refptr<State> state) { | 
 |  26   // TODO(liberato): check for duplicates.  Not sure why set doesn't work, | 
 |  27   // since it seems like there should be a default hash defined for refptr. | 
 |  28   // maybe define one if not, but probably i just forgot to tell the set | 
 |  29   // about it. | 
 |  30   state->RegisterClient(this); | 
 |  31   states_.push_back(state); | 
 |  32 } | 
 |  33  | 
 |  34 }  // namespace media | 
| OLD | NEW |