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

Unified Diff: third_party/cacheinvalidation/src/google/cacheinvalidation/impl/invalidation-client-core.cc

Issue 2561963002: base: Remove the string logging from CHECK(). (Closed)
Patch Set: checkstring: rebase Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/cacheinvalidation/src/google/cacheinvalidation/impl/invalidation-client-core.cc
diff --git a/third_party/cacheinvalidation/src/google/cacheinvalidation/impl/invalidation-client-core.cc b/third_party/cacheinvalidation/src/google/cacheinvalidation/impl/invalidation-client-core.cc
index 70762d0871e5d609a3c0acee4b9a631aaa86c639..79fe17f1e7892371e573fba18897e70cda25d87e 100644
--- a/third_party/cacheinvalidation/src/google/cacheinvalidation/impl/invalidation-client-core.cc
+++ b/third_party/cacheinvalidation/src/google/cacheinvalidation/impl/invalidation-client-core.cc
@@ -270,7 +270,8 @@ void InvalidationClientCore::InitConfigForTest(ClientConfigP* config) {
}
void InvalidationClientCore::Start() {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
if (ticl_state_.IsStarted()) {
TLOG(logger_, SEVERE,
"Ignoring start call since already started: client = %s",
@@ -291,10 +292,11 @@ void InvalidationClientCore::Start() {
}
void InvalidationClientCore::StartInternal(const string& serialized_state) {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
- CHECK(resources_->IsStarted()) << "Resources must be started before starting "
- "the Ticl";
+ // Resources must be started before starting the Ticl
+ CHECK(resources_->IsStarted());
// Initialize the session manager using the persisted client token.
PersistentTiclState persistent_state;
@@ -357,7 +359,8 @@ void InvalidationClientCore::StartInternal(const string& serialized_state) {
}
void InvalidationClientCore::Stop() {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
TLOG(logger_, WARNING, "Ticl being stopped: %s", ToString().c_str());
if (ticl_state_.IsStarted()) {
ticl_state_.Stop();
@@ -365,14 +368,16 @@ void InvalidationClientCore::Stop() {
}
void InvalidationClientCore::Register(const ObjectId& object_id) {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
vector<ObjectId> object_ids;
object_ids.push_back(object_id);
PerformRegisterOperations(object_ids, RegistrationP_OpType_REGISTER);
}
void InvalidationClientCore::Unregister(const ObjectId& object_id) {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
vector<ObjectId> object_ids;
object_ids.push_back(object_id);
PerformRegisterOperations(object_ids, RegistrationP_OpType_UNREGISTER);
@@ -380,8 +385,10 @@ void InvalidationClientCore::Unregister(const ObjectId& object_id) {
void InvalidationClientCore::PerformRegisterOperations(
const vector<ObjectId>& object_ids, RegistrationP::OpType reg_op_type) {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
- CHECK(!object_ids.empty()) << "Must specify some object id";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
+ // Must specify some object id
+ CHECK(!object_ids.empty());
if (ticl_state_.IsStopped()) {
// The Ticl has been stopped. This might be some old registration op
@@ -438,7 +445,8 @@ void InvalidationClientCore::PerformRegisterOperations(
}
void InvalidationClientCore::Acknowledge(const AckHandle& acknowledge_handle) {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
if (acknowledge_handle.IsNoOp()) {
// Nothing to do. We do not increment statistics here since this is a no op
// handle and statistics can only be acccessed on the scheduler thread.
@@ -490,7 +498,8 @@ string InvalidationClientCore::GetClientToken() {
}
void InvalidationClientCore::HandleIncomingMessage(const string& message) {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
statistics_->RecordReceivedMessage(
Statistics::ReceivedMessageType_TOTAL);
ParsedMessage parsed_message;
@@ -565,7 +574,8 @@ void InvalidationClientCore::HandleIncomingMessage(const string& message) {
void InvalidationClientCore::HandleTokenChanged(
const string& header_token, const string& new_token) {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
// The server is either supplying a new token in response to an
// InitializeMessage, spontaneously destroying a token we hold, or
@@ -602,14 +612,16 @@ void InvalidationClientCore::HandleTokenChanged(
}
void InvalidationClientCore::ScheduleAcquireToken(const string& debug_string) {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
set_client_token("");
acquire_token_task_.get()->EnsureScheduled(debug_string);
}
void InvalidationClientCore::HandleInvalidations(
const RepeatedPtrField<InvalidationP>& invalidations) {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
for (int i = 0; i < invalidations.size(); ++i) {
const InvalidationP& invalidation = invalidations.Get(i);
@@ -645,14 +657,15 @@ void InvalidationClientCore::HandleInvalidations(
void InvalidationClientCore::HandleRegistrationStatus(
const RepeatedPtrField<RegistrationStatus>& reg_status_list) {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
vector<bool> local_processing_statuses;
registration_manager_.HandleRegistrationStatus(
reg_status_list, &local_processing_statuses);
+ // Not all registration statuses were processed
CHECK(local_processing_statuses.size() ==
- static_cast<size_t>(reg_status_list.size())) <<
- "Not all registration statuses were processed";
+ static_cast<size_t>(reg_status_list.size()));
// Inform app about the success or failure of each registration based
// on what the registration manager has indicated.
@@ -688,7 +701,8 @@ void InvalidationClientCore::HandleRegistrationStatus(
}
void InvalidationClientCore::HandleRegistrationSyncRequest() {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
// Send all the registrations in the reg sync message.
// Generate a single subtree for all the registrations.
RegistrationSubtree subtree;
@@ -698,7 +712,8 @@ void InvalidationClientCore::HandleRegistrationSyncRequest() {
void InvalidationClientCore::HandleInfoMessage(
const RepeatedField<InfoRequestMessage_InfoType>& info_types) {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
bool must_send_performance_counters = false;
for (int i = 0; i < info_types.size(); ++i) {
must_send_performance_counters =
@@ -715,7 +730,8 @@ void InvalidationClientCore::HandleInfoMessage(
void InvalidationClientCore::HandleErrorMessage(
ErrorMessage::Code code,
const string& description) {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
// If it is an auth failure, we shut down the ticl.
TLOG(logger_, SEVERE, "Received error message: %s, %s",
@@ -761,14 +777,16 @@ void InvalidationClientCore::HandleErrorMessage(
}
void InvalidationClientCore::HandleMessageSent() {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
last_message_send_time_ = internal_scheduler_->GetCurrentTime();
}
void InvalidationClientCore::HandleNetworkStatusChange(bool is_online) {
// If we're back online and haven't sent a message to the server in a while,
// send a heartbeat to make sure the server knows we're online.
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
bool was_online = is_online_;
is_online_ = is_online;
if (is_online && !was_online &&
@@ -813,10 +831,11 @@ void InvalidationClientCore::GetStatisticsAsSerializedProto(
void InvalidationClientCore::HandleIncomingHeader(
const ServerMessageHeader& header) {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
- CHECK(nonce_.empty()) <<
- "Cannot process server header " << header.ToString() <<
- " with non-empty nonce " << nonce_;
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
+ // Cannot process server header |header.ToString()| with non-empty nonce
+ // |nonce_|.
+ CHECK(nonce_.empty());
if (header.registration_summary() != NULL) {
// We've received a summary from the server, so if we were suppressing
@@ -848,7 +867,8 @@ void InvalidationClientCore::HandleIncomingHeader(
}
bool InvalidationClientCore::ValidateToken(const string& server_token) {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
if (!client_token_.empty()) {
// Client token case.
if (client_token_ != server_token) {
@@ -860,9 +880,6 @@ bool InvalidationClientCore::ValidateToken(const string& server_token) {
}
return true;
} else if (!nonce_.empty()) {
- // Nonce case.
- CHECK(!nonce_.empty()) << "Client token and nonce are both empty: "
- << client_token_ << ", " << nonce_;
if (nonce_ != server_token) {
statistics_->RecordError(Statistics::ClientErrorType_NONCE_MISMATCH);
TLOG(logger_, INFO,
@@ -886,7 +903,8 @@ void InvalidationClientCore::SendInfoMessageToServer(
TLOG(logger_, INFO,
"Sending info message to server; request server summary = %s",
request_server_summary ? "true" : "false");
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
// Make sure that you have the latest registration summary.
vector<pair<string, int> > performance_counters;
@@ -905,16 +923,18 @@ string InvalidationClientCore::GenerateNonce(Random* random) {
}
void InvalidationClientCore::set_nonce(const string& new_nonce) {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
- CHECK(new_nonce.empty() || client_token_.empty()) <<
- "Tried to set nonce with existing token " << client_token_;
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
+ // Tried to set nonce with existing token |client_token_|.
+ CHECK(new_nonce.empty() || client_token_.empty());
nonce_ = new_nonce;
}
void InvalidationClientCore::set_client_token(const string& new_client_token) {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
- CHECK(new_client_token.empty() || nonce_.empty()) <<
- "Tried to set token with existing nonce " << nonce_;
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
+ // Tried to set token with existing nonce |nonce_|.
+ CHECK(new_client_token.empty() || nonce_.empty());
// If the ticl has not been started and we are getting a new token (either
// from persistence or from the server, start the ticl and inform the
@@ -929,7 +949,8 @@ void InvalidationClientCore::set_client_token(const string& new_client_token) {
}
void InvalidationClientCore::FinishStartingTiclAndInformListener() {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
CHECK(!ticl_state_.IsStarted());
ticl_state_.Start();
@@ -944,7 +965,8 @@ void InvalidationClientCore::FinishStartingTiclAndInformListener() {
}
void InvalidationClientCore::ScheduleStartAfterReadingStateBlob() {
- CHECK(internal_scheduler_->IsRunningOnThread()) << "Not on internal thread";
+ // Not on internal thread
+ CHECK(internal_scheduler_->IsRunningOnThread());
storage_->ReadKey(kClientTokenKey,
NewPermanentCallback(this, &InvalidationClientCore::ReadCallback));
}

Powered by Google App Engine
This is Rietveld 408576698