blob: 90c1f0f74c35e4253ab1cd2929ac8a86116aee3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// 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 <string>
#include <vector>
#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<const Value*>& args);
~JsArgList();
const ListValue& Get() const;
std::string ToString() const;
private:
class SharedListValue : public base::RefCountedThreadSafe<SharedListValue> {
public:
SharedListValue();
explicit SharedListValue(const ListValue& list_value);
explicit SharedListValue(const std::vector<const Value*>& value_list);
const ListValue& Get() const;
private:
virtual ~SharedListValue();
friend class base::RefCountedThreadSafe<SharedListValue>;
ListValue list_value_;
};
scoped_refptr<const SharedListValue> args_;
// Copy constructor and assignment operator welcome.
};
} // namespace browser_sync
#endif // CHROME_BROWSER_SYNC_JS_ARG_LIST_H_
|