Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: net/http/disk_cache_based_quic_server_info.cc

Issue 2652893006: Releases DiskCacheBasedQuicServerInfo::|new_data_| and |pending_write_data_| (Closed)
Patch Set: use STLClearObject instead Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/http/disk_cache_based_quic_server_info.h" 5 #include "net/http/disk_cache_based_quic_server_info.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
12 #include "base/stl_util.h"
12 #include "net/base/completion_callback.h" 13 #include "net/base/completion_callback.h"
13 #include "net/base/io_buffer.h" 14 #include "net/base/io_buffer.h"
14 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
15 #include "net/http/http_cache.h" 16 #include "net/http/http_cache.h"
16 #include "net/http/http_network_session.h" 17 #include "net/http/http_network_session.h"
17 #include "net/quic/core/quic_server_id.h" 18 #include "net/quic/core/quic_server_id.h"
18 19
19 namespace net { 20 namespace net {
20 21
21 // Some APIs inside disk_cache take a handle that the caller must keep alive 22 // Some APIs inside disk_cache take a handle that the caller must keep alive
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 DCHECK(CalledOnValidThread()); 152 DCHECK(CalledOnValidThread());
152 DCHECK_NE(GET_BACKEND, state_); 153 DCHECK_NE(GET_BACKEND, state_);
153 DCHECK(new_data_.empty()); 154 DCHECK(new_data_.empty());
154 CHECK(ready_); 155 CHECK(ready_);
155 DCHECK(wait_for_ready_callback_.is_null()); 156 DCHECK(wait_for_ready_callback_.is_null());
156 157
157 if (pending_write_data_.empty()) { 158 if (pending_write_data_.empty()) {
158 new_data_ = Serialize(); 159 new_data_ = Serialize();
159 } else { 160 } else {
160 new_data_ = pending_write_data_; 161 new_data_ = pending_write_data_;
161 pending_write_data_.clear(); 162 base::STLClearObject(&pending_write_data_);
162 } 163 }
163 164
164 RecordQuicServerInfoStatus(QUIC_SERVER_INFO_PERSIST); 165 RecordQuicServerInfoStatus(QUIC_SERVER_INFO_PERSIST);
165 if (!backend_) { 166 if (!backend_) {
166 RecordQuicServerInfoFailure(PERSIST_NO_BACKEND_FAILURE); 167 RecordQuicServerInfoFailure(PERSIST_NO_BACKEND_FAILURE);
167 return; 168 return;
168 } 169 }
169 170
170 state_ = CREATE_OR_OPEN; 171 state_ = CREATE_OR_OPEN;
171 DoLoop(OK); 172 DoLoop(OK);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 384
384 UMA_HISTOGRAM_TIMES("Net.QuicServerInfo.DiskCacheLoadTime", 385 UMA_HISTOGRAM_TIMES("Net.QuicServerInfo.DiskCacheLoadTime",
385 base::TimeTicks::Now() - load_start_time_); 386 base::TimeTicks::Now() - load_start_time_);
386 return OK; 387 return OK;
387 } 388 }
388 389
389 int DiskCacheBasedQuicServerInfo::DoSetDone() { 390 int DiskCacheBasedQuicServerInfo::DoSetDone() {
390 if (entry_) 391 if (entry_)
391 entry_->Close(); 392 entry_->Close();
392 entry_ = NULL; 393 entry_ = NULL;
393 new_data_.clear(); 394 base::STLClearObject(&new_data_);
394 state_ = NONE; 395 state_ = NONE;
395 return OK; 396 return OK;
396 } 397 }
397 398
398 void DiskCacheBasedQuicServerInfo::RecordQuicServerInfoStatus( 399 void DiskCacheBasedQuicServerInfo::RecordQuicServerInfoStatus(
399 QuicServerInfoAPICall call) { 400 QuicServerInfoAPICall call) {
400 if (!backend_) { 401 if (!backend_) {
401 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.APICall.NoBackend", call, 402 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.APICall.NoBackend", call,
402 QUIC_SERVER_INFO_NUM_OF_API_CALLS); 403 QUIC_SERVER_INFO_NUM_OF_API_CALLS);
403 } else if (backend_->GetCacheType() == MEMORY_CACHE) { 404 } else if (backend_->GetCacheType() == MEMORY_CACHE) {
(...skipping 24 matching lines...) Expand all
428 } else if (backend_->GetCacheType() == MEMORY_CACHE) { 429 } else if (backend_->GetCacheType() == MEMORY_CACHE) {
429 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.MemoryCache", 430 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.MemoryCache",
430 failure, NUM_OF_FAILURES); 431 failure, NUM_OF_FAILURES);
431 } else { 432 } else {
432 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.DiskCache", 433 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.DiskCache",
433 failure, NUM_OF_FAILURES); 434 failure, NUM_OF_FAILURES);
434 } 435 }
435 } 436 }
436 437
437 } // namespace net 438 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698