1 // Copyright 2013 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 "google_apis/gcm/gcm_client.h" 6 7 #include "base/lazy_instance.h" 8 #include "google_apis/gcm/gcm_client_impl.h" 9 10 namespace gcm { 11 12 namespace { 13 14 static base::LazyInstance<GCMClientImpl>::Leaky g_gcm_client = 15 LAZY_INSTANCE_INITIALIZER; 16 static GCMClient* g_gcm_client_override = NULL; 17 18 } // namespace 19 OutgoingMessage()20GCMClient::OutgoingMessage::OutgoingMessage() 21 : time_to_live(0) { 22 } 23 ~OutgoingMessage()24GCMClient::OutgoingMessage::~OutgoingMessage() { 25 } 26 IncomingMessage()27GCMClient::IncomingMessage::IncomingMessage() { 28 } 29 ~IncomingMessage()30GCMClient::IncomingMessage::~IncomingMessage() { 31 } 32 33 // static Get()34GCMClient* GCMClient::Get() { 35 if (g_gcm_client_override) 36 return g_gcm_client_override; 37 return g_gcm_client.Pointer(); 38 } 39 40 // static SetForTesting(GCMClient * client)41void GCMClient::SetForTesting(GCMClient* client) { 42 g_gcm_client_override = client; 43 } 44 45 } // namespace gcm 46