// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_TEST_CHROMEDRIVER_SESSION_H_ #define CHROME_TEST_CHROMEDRIVER_SESSION_H_ #include #include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/synchronization/lock.h" struct Session { explicit Session(const std::string& id); ~Session(); const std::string id; }; class SessionAccessor : public base::RefCountedThreadSafe { public: virtual Session* Access(scoped_ptr* lock) = 0; protected: friend class base::RefCountedThreadSafe; virtual ~SessionAccessor() {} }; class SessionAccessorImpl : public SessionAccessor { public: explicit SessionAccessorImpl(scoped_ptr session); virtual Session* Access(scoped_ptr* lock) OVERRIDE; private: virtual ~SessionAccessorImpl(); base::Lock session_lock_; scoped_ptr session_; DISALLOW_COPY_AND_ASSIGN(SessionAccessorImpl); }; #endif // CHROME_TEST_CHROMEDRIVER_SESSION_H_