Update V8 to version 4.5.92.
[chromium-blink-merge.git] / chrome / service / cloud_print / cloud_print_token_store.cc
blob1fb39b026cbe44640c4932a02dcb9f0fac8ab8e2
1 // Copyright (c) 2011 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.
5 #include "chrome/service/cloud_print/cloud_print_token_store.h"
7 #include "base/lazy_instance.h"
8 #include "base/threading/thread_local.h"
10 namespace cloud_print {
12 // Keep the global CloudPrintTokenStore in a TLS slot so it is impossible to
13 // incorrectly from the wrong thread.
14 static base::LazyInstance<base::ThreadLocalPointer<CloudPrintTokenStore> >
15 lazy_tls = LAZY_INSTANCE_INITIALIZER;
17 CloudPrintTokenStore* CloudPrintTokenStore::current() {
18 return lazy_tls.Pointer()->Get();
21 CloudPrintTokenStore::CloudPrintTokenStore() {
22 lazy_tls.Pointer()->Set(this);
25 CloudPrintTokenStore::~CloudPrintTokenStore() {
26 lazy_tls.Pointer()->Set(NULL);
29 void CloudPrintTokenStore::SetToken(const std::string& token) {
30 DCHECK(CalledOnValidThread());
31 token_ = token;
34 } // namespace cloud_print