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

Side by Side Diff: components/sync/engine_impl/clear_server_data.cc

Issue 2258873003: [Sync] Move sessions/ to engine/cycle/ and rename things to match. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 4 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 | « components/sync/engine_impl/clear_server_data.h ('k') | components/sync/engine_impl/commit.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/sync/engine_impl/clear_server_data.h" 5 #include "components/sync/engine_impl/clear_server_data.h"
6 6
7 #include "base/trace_event/trace_event.h" 7 #include "base/trace_event/trace_event.h"
8 #include "components/sync/engine/events/clear_server_data_request_event.h" 8 #include "components/sync/engine/events/clear_server_data_request_event.h"
9 #include "components/sync/engine/events/clear_server_data_response_event.h" 9 #include "components/sync/engine/events/clear_server_data_response_event.h"
10 #include "components/sync/engine_impl/cycle/sync_cycle.h"
10 #include "components/sync/engine_impl/syncer.h" 11 #include "components/sync/engine_impl/syncer.h"
11 #include "components/sync/engine_impl/syncer_proto_util.h" 12 #include "components/sync/engine_impl/syncer_proto_util.h"
12 #include "components/sync/sessions_impl/sync_session.h"
13 13
14 namespace syncer { 14 namespace syncer {
15 15
16 ClearServerData::ClearServerData(const std::string& account_name) { 16 ClearServerData::ClearServerData(const std::string& account_name) {
17 request_.set_share(account_name); 17 request_.set_share(account_name);
18 request_.set_message_contents( 18 request_.set_message_contents(
19 sync_pb::ClientToServerMessage::CLEAR_SERVER_DATA); 19 sync_pb::ClientToServerMessage::CLEAR_SERVER_DATA);
20 request_.mutable_clear_server_data(); 20 request_.mutable_clear_server_data();
21 } 21 }
22 22
23 ClearServerData::~ClearServerData() {} 23 ClearServerData::~ClearServerData() {}
24 24
25 SyncerError ClearServerData::SendRequest(sessions::SyncSession* session) { 25 SyncerError ClearServerData::SendRequest(SyncCycle* cycle) {
26 if (session->context()->debug_info_getter()) { 26 if (cycle->context()->debug_info_getter()) {
27 sync_pb::DebugInfo* debug_info = request_.mutable_debug_info(); 27 sync_pb::DebugInfo* debug_info = request_.mutable_debug_info();
28 session->context()->debug_info_getter()->GetDebugInfo(debug_info); 28 cycle->context()->debug_info_getter()->GetDebugInfo(debug_info);
29 } 29 }
30 30
31 DVLOG(1) << "Sending ClearServerData message."; 31 DVLOG(1) << "Sending ClearServerData message.";
32 32
33 const ClearServerDataRequestEvent request_event(base::Time::Now(), request_); 33 const ClearServerDataRequestEvent request_event(base::Time::Now(), request_);
34 session->SendProtocolEvent(request_event); 34 cycle->SendProtocolEvent(request_event);
35 35
36 sync_pb::ClientToServerResponse response; 36 sync_pb::ClientToServerResponse response;
37 37
38 TRACE_EVENT_BEGIN0("sync", "PostClearServerData"); 38 TRACE_EVENT_BEGIN0("sync", "PostClearServerData");
39 const SyncerError post_result = SyncerProtoUtil::PostClientToServerMessage( 39 const SyncerError post_result = SyncerProtoUtil::PostClientToServerMessage(
40 &request_, &response, session, nullptr); 40 &request_, &response, cycle, nullptr);
41 TRACE_EVENT_END0("sync", "PostClearServerData"); 41 TRACE_EVENT_END0("sync", "PostClearServerData");
42 42
43 const ClearServerDataResponseEvent response_event(base::Time::Now(), 43 const ClearServerDataResponseEvent response_event(base::Time::Now(),
44 post_result, response); 44 post_result, response);
45 session->SendProtocolEvent(response_event); 45 cycle->SendProtocolEvent(response_event);
46 46
47 if (post_result != SYNCER_OK) { 47 if (post_result != SYNCER_OK) {
48 DVLOG(1) << "Post ClearServerData failed"; 48 DVLOG(1) << "Post ClearServerData failed";
49 return post_result; 49 return post_result;
50 } 50 }
51 51
52 if (!response.has_clear_server_data()) { 52 if (!response.has_clear_server_data()) {
53 DVLOG(1) << "ClearServerData response has no ClearServerData body!"; 53 DVLOG(1) << "ClearServerData response has no ClearServerData body!";
54 return SERVER_RESPONSE_VALIDATION_FAILED; 54 return SERVER_RESPONSE_VALIDATION_FAILED;
55 } 55 }
56 56
57 if (session->context()->debug_info_getter()) { 57 if (cycle->context()->debug_info_getter()) {
58 DVLOG(1) << "Clearing client debug info."; 58 DVLOG(1) << "Clearing client debug info.";
59 session->context()->debug_info_getter()->ClearDebugInfo(); 59 cycle->context()->debug_info_getter()->ClearDebugInfo();
60 } 60 }
61 61
62 return post_result; 62 return post_result;
63 } 63 }
64 64
65 } // namespace syncer 65 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine_impl/clear_server_data.h ('k') | components/sync/engine_impl/commit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698