| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/sdch/sdch_owner.h" | 5 #include "net/sdch/sdch_owner.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/alias.h" | 8 #include "base/debug/alias.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 dictionary_description->SetString(kDictionaryUrlKey, dictionary_url.spec()); | 477 dictionary_description->SetString(kDictionaryUrlKey, dictionary_url.spec()); |
| 478 dictionary_description->SetDouble(kDictionaryLastUsedKey, | 478 dictionary_description->SetDouble(kDictionaryLastUsedKey, |
| 479 last_used.ToDoubleT()); | 479 last_used.ToDoubleT()); |
| 480 dictionary_description->SetInteger(kDictionaryUseCountKey, use_count); | 480 dictionary_description->SetInteger(kDictionaryUseCountKey, use_count); |
| 481 dictionary_description->SetInteger(kDictionarySizeKey, | 481 dictionary_description->SetInteger(kDictionarySizeKey, |
| 482 dictionary_text.size()); | 482 dictionary_text.size()); |
| 483 pref_dictionary_map->Set(server_hash, dictionary_description.Pass()); | 483 pref_dictionary_map->Set(server_hash, dictionary_description.Pass()); |
| 484 load_times_[server_hash] = clock_->Now(); | 484 load_times_[server_hash] = clock_->Now(); |
| 485 } | 485 } |
| 486 | 486 |
| 487 void SdchOwner::OnDictionaryAdded(SdchManager* manager, |
| 488 const GURL& dictionary_url, |
| 489 const std::string& server_hash) { } |
| 490 |
| 491 void SdchOwner::OnDictionaryRemoved(SdchManager* manager, |
| 492 const std::string& server_hash) { } |
| 493 |
| 487 void SdchOwner::OnDictionaryUsed(SdchManager* manager, | 494 void SdchOwner::OnDictionaryUsed(SdchManager* manager, |
| 488 const std::string& server_hash) { | 495 const std::string& server_hash) { |
| 489 base::Time now(clock_->Now()); | 496 base::Time now(clock_->Now()); |
| 490 base::DictionaryValue* pref_dictionary_map = | 497 base::DictionaryValue* pref_dictionary_map = |
| 491 GetPersistentStoreDictionaryMap(pref_store_); | 498 GetPersistentStoreDictionaryMap(pref_store_); |
| 492 ScopedPrefNotifier scoped_pref_notifier(pref_store_); | 499 ScopedPrefNotifier scoped_pref_notifier(pref_store_); |
| 493 | 500 |
| 494 base::Value* value = nullptr; | 501 base::Value* value = nullptr; |
| 495 bool success = pref_dictionary_map->Get(server_hash, &value); | 502 bool success = pref_dictionary_map->Get(server_hash, &value); |
| 496 if (!success) { | 503 if (!success) { |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 } | 779 } |
| 773 | 780 |
| 774 return true; | 781 return true; |
| 775 } | 782 } |
| 776 | 783 |
| 777 bool SdchOwner::IsPersistingDictionaries() const { | 784 bool SdchOwner::IsPersistingDictionaries() const { |
| 778 return in_memory_pref_store_.get() != nullptr; | 785 return in_memory_pref_store_.get() != nullptr; |
| 779 } | 786 } |
| 780 | 787 |
| 781 } // namespace net | 788 } // namespace net |
| OLD | NEW |