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

Side by Side Diff: net/disk_cache/disk_cache_test_base.cc

Issue 15984016: Call scoped_refptr<T>::get() rather than relying on implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/disk_cache_perftest.cc ('k') | net/disk_cache/disk_cache_test_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/disk_cache/disk_cache_test_base.h" 5 #include "net/disk_cache/disk_cache_test_base.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); 259 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)));
260 } 260 }
261 ASSERT_TRUE(cache_thread_.message_loop() != NULL); 261 ASSERT_TRUE(cache_thread_.message_loop() != NULL);
262 262
263 CreateBackend(disk_cache::kNoRandom, &cache_thread_); 263 CreateBackend(disk_cache::kNoRandom, &cache_thread_);
264 } 264 }
265 265
266 void DiskCacheTestWithCache::CreateBackend(uint32 flags, base::Thread* thread) { 266 void DiskCacheTestWithCache::CreateBackend(uint32 flags, base::Thread* thread) {
267 base::MessageLoopProxy* runner; 267 base::MessageLoopProxy* runner;
268 if (use_current_thread_) 268 if (use_current_thread_)
269 runner = base::MessageLoopProxy::current(); 269 runner = base::MessageLoopProxy::current().get();
270 else 270 else
271 runner = thread->message_loop_proxy(); 271 runner = thread->message_loop_proxy().get();
272 272
273 if (simple_cache_mode_) { 273 if (simple_cache_mode_) {
274 net::TestCompletionCallback cb; 274 net::TestCompletionCallback cb;
275 disk_cache::SimpleBackendImpl* simple_backend = 275 disk_cache::SimpleBackendImpl* simple_backend =
276 new disk_cache::SimpleBackendImpl(cache_path_, size_, type_, 276 new disk_cache::SimpleBackendImpl(
277 make_scoped_refptr(runner), NULL); 277 cache_path_, size_, type_, make_scoped_refptr(runner).get(), NULL);
278 int rv = simple_backend->Init(cb.callback()); 278 int rv = simple_backend->Init(cb.callback());
279 ASSERT_EQ(net::OK, cb.GetResult(rv)); 279 ASSERT_EQ(net::OK, cb.GetResult(rv));
280 cache_ = simple_cache_impl_ = simple_backend; 280 cache_ = simple_cache_impl_ = simple_backend;
281 return; 281 return;
282 } 282 }
283 283
284 if (mask_) 284 if (mask_)
285 cache_impl_ = new disk_cache::BackendImpl(cache_path_, mask_, runner, NULL); 285 cache_impl_ = new disk_cache::BackendImpl(cache_path_, mask_, runner, NULL);
286 else 286 else
287 cache_impl_ = new disk_cache::BackendImpl(cache_path_, runner, NULL); 287 cache_impl_ = new disk_cache::BackendImpl(cache_path_, runner, NULL);
288 cache_ = cache_impl_; 288 cache_ = cache_impl_;
289 ASSERT_TRUE(NULL != cache_); 289 ASSERT_TRUE(NULL != cache_);
290 if (size_) 290 if (size_)
291 EXPECT_TRUE(cache_impl_->SetMaxSize(size_)); 291 EXPECT_TRUE(cache_impl_->SetMaxSize(size_));
292 if (new_eviction_) 292 if (new_eviction_)
293 cache_impl_->SetNewEviction(); 293 cache_impl_->SetNewEviction();
294 cache_impl_->SetType(type_); 294 cache_impl_->SetType(type_);
295 cache_impl_->SetFlags(flags); 295 cache_impl_->SetFlags(flags);
296 net::TestCompletionCallback cb; 296 net::TestCompletionCallback cb;
297 int rv = cache_impl_->Init(cb.callback()); 297 int rv = cache_impl_->Init(cb.callback());
298 ASSERT_EQ(net::OK, cb.GetResult(rv)); 298 ASSERT_EQ(net::OK, cb.GetResult(rv));
299 cache_ = cache_impl_; 299 cache_ = cache_impl_;
300 } 300 }
OLDNEW
« no previous file with comments | « net/disk_cache/disk_cache_perftest.cc ('k') | net/disk_cache/disk_cache_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698