// Copyright (c) 2011 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_BROWSER_SYNC_JS_ARG_LIST_H_ #define CHROME_BROWSER_SYNC_JS_ARG_LIST_H_ #pragma once // See README.js for design comments. #include #include #include "base/memory/ref_counted.h" #include "base/values.h" namespace browser_sync { // A thread-safe ref-counted wrapper around an immutable ListValue. // Used for passing around argument lists to different threads. class JsArgList { public: JsArgList(); explicit JsArgList(const ListValue& args); explicit JsArgList(const std::vector& args); ~JsArgList(); const ListValue& Get() const; std::string ToString() const; private: class SharedListValue : public base::RefCountedThreadSafe { public: SharedListValue(); explicit SharedListValue(const ListValue& list_value); explicit SharedListValue(const std::vector& value_list); const ListValue& Get() const; private: virtual ~SharedListValue(); friend class base::RefCountedThreadSafe; ListValue list_value_; }; scoped_refptr args_; // Copy constructor and assignment operator welcome. }; } // namespace browser_sync #endif // CHROME_BROWSER_SYNC_JS_ARG_LIST_H_