| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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 "chrome/browser/google_apis/request_registry.h" | |
| 6 | |
| 7 namespace google_apis { | |
| 8 | |
| 9 RequestRegistry::Request::Request(RequestRegistry* registry) | |
| 10 : registry_(registry), id_(-1) { | |
| 11 } | |
| 12 | |
| 13 RequestRegistry::Request::~Request() { | |
| 14 } | |
| 15 | |
| 16 void RequestRegistry::Request::NotifyStart() { | |
| 17 registry_->OnRequestStart(this, &id_); | |
| 18 } | |
| 19 | |
| 20 void RequestRegistry::Request::NotifyFinish() { | |
| 21 registry_->OnRequestFinish(id_); | |
| 22 } | |
| 23 | |
| 24 RequestRegistry::RequestRegistry() { | |
| 25 in_flight_requests_.set_check_on_null_data(true); | |
| 26 } | |
| 27 | |
| 28 RequestRegistry::~RequestRegistry() { | |
| 29 } | |
| 30 | |
| 31 void RequestRegistry::OnRequestStart( | |
| 32 RequestRegistry::Request* request, | |
| 33 RequestID* id) { | |
| 34 *id = in_flight_requests_.Add(request); | |
| 35 } | |
| 36 | |
| 37 void RequestRegistry::OnRequestFinish(RequestID id) { | |
| 38 if (in_flight_requests_.Lookup(id)) | |
| 39 in_flight_requests_.Remove(id); | |
| 40 } | |
| 41 | |
| 42 } // namespace google_apis | |
| OLD | NEW |