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

Side by Side Diff: sync/api/attachments/attachment_service_proxy_for_test.cc

Issue 213003004: Replace calls to 3-arg SyncData::CreateLocalData with 5-arg version. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@syncapi
Patch Set: Forgot a class keyword. Created 6 years, 8 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "sync/api/attachments/attachment_service_proxy_for_test.h"
6
7 #include "base/message_loop/message_loop_proxy.h"
8 #include "sync/api/attachments/fake_attachment_service.h"
9
10 namespace syncer {
11
12 // Static.
13 scoped_refptr<AttachmentServiceProxyForTest>
14 AttachmentServiceProxyForTest::Create() {
15 scoped_ptr<AttachmentService> wrapped(FakeAttachmentService::CreateForTest());
16 // This class's base class, AttachmentServiceProxy, must be initialized with a
17 // WeakPtr to an AttachmentService. Because the base class ctor must be
18 // invoked before any of this class's members are initialized, we create the
19 // WeakPtrFactory here and pass it to the ctor so that it may initialize its
20 // base class and own the WeakPtrFactory.
21 //
22 // We must pass by scoped_ptr because WeakPtrFactory has no copy constructor.
23 scoped_ptr<base::WeakPtrFactory<AttachmentService> > weak_ptr_factory(
24 new base::WeakPtrFactory<AttachmentService>(wrapped.get()));
25 return new AttachmentServiceProxyForTest(wrapped.Pass(),
26 weak_ptr_factory.Pass());
27 }
28
29 AttachmentServiceProxyForTest::~AttachmentServiceProxyForTest() {}
30
31 AttachmentServiceProxyForTest::AttachmentServiceProxyForTest(
32 scoped_ptr<AttachmentService> wrapped,
33 scoped_ptr<base::WeakPtrFactory<AttachmentService> > weak_ptr_factory)
34 : AttachmentServiceProxy(base::MessageLoopProxy::current(),
35 weak_ptr_factory->GetWeakPtr()),
36 wrapped_(wrapped.Pass()),
37 weak_ptr_factory_(weak_ptr_factory.Pass()) {}
38
39 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698