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

Side by Side Diff: components/update_client/ping_manager.cc

Issue 2888183003: Consolidate the update_client serialization code. (Closed)
Patch Set: wip Created 3 years, 7 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
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 "components/update_client/ping_manager.h" 5 #include "components/update_client/ping_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 void PingSender::OnRequestSenderComplete(int error, 60 void PingSender::OnRequestSenderComplete(int error,
61 const std::string& response, 61 const std::string& response,
62 int retry_after_sec) { 62 int retry_after_sec) {
63 DCHECK(thread_checker_.CalledOnValidThread()); 63 DCHECK(thread_checker_.CalledOnValidThread());
64 delete this; 64 delete this;
65 } 65 }
66 66
67 bool PingSender::SendPing(const Component& component) { 67 bool PingSender::SendPing(const Component& component) {
68 DCHECK(thread_checker_.CalledOnValidThread()); 68 DCHECK(thread_checker_.CalledOnValidThread());
69 69
70 if (component.events().empty())
71 return false;
72
70 auto urls(config_->PingUrl()); 73 auto urls(config_->PingUrl());
71 if (component.crx_component().requires_network_encryption) 74 if (component.crx_component().requires_network_encryption)
72 RemoveUnsecureUrls(&urls); 75 RemoveUnsecureUrls(&urls);
73 76
74 if (urls.empty()) 77 if (urls.empty())
75 return false; 78 return false;
76 79
77 request_sender_ = base::MakeUnique<RequestSender>(config_); 80 request_sender_ = base::MakeUnique<RequestSender>(config_);
78 request_sender_->Send( 81 request_sender_->Send(
79 false, BuildEventPingRequest(*config_, component), urls, 82 false, BuildEventPingRequest(*config_, component), urls,
(...skipping 16 matching lines...) Expand all
96 auto ping_sender = base::MakeUnique<PingSender>(config_); 99 auto ping_sender = base::MakeUnique<PingSender>(config_);
97 if (!ping_sender->SendPing(component)) 100 if (!ping_sender->SendPing(component))
98 return false; 101 return false;
99 102
100 // The ping sender object self-deletes after sending the ping asynchrously. 103 // The ping sender object self-deletes after sending the ping asynchrously.
101 ping_sender.release(); 104 ping_sender.release();
102 return true; 105 return true;
103 } 106 }
104 107
105 } // namespace update_client 108 } // namespace update_client
OLDNEW
« no previous file with comments | « components/update_client/component.cc ('k') | components/update_client/ping_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698