diff options
author | kushi.p@gmail.com <kushi.p@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-28 18:20:09 +0000 |
---|---|---|
committer | kushi.p@gmail.com <kushi.p@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-28 18:20:09 +0000 |
commit | 5e0be64ec9fa6b9255c70d8982c9469cab48e4d8 (patch) | |
tree | 05196e9f8920cfa7203e8fead723f6eeee446788 | |
parent | 961ac948a36146baafc52f957dfd187b19d2cd04 (diff) | |
download | chromium_src-5e0be64ec9fa6b9255c70d8982c9469cab48e4d8.zip chromium_src-5e0be64ec9fa6b9255c70d8982c9469cab48e4d8.tar.gz chromium_src-5e0be64ec9fa6b9255c70d8982c9469cab48e4d8.tar.bz2 |
Improving logging in /app, /base, /crypto and /ipc. Updating plain DCHECK() usages for DCHECK_EQ/LE/GE() equivalents.
BUG=58409
TEST=None
Review URL: http://codereview.chromium.org/6880166
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83362 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | app/win/iat_patch_function.cc | 6 | ||||
-rw-r--r-- | base/at_exit.cc | 2 | ||||
-rw-r--r-- | crypto/cssm_init.cc | 20 | ||||
-rw-r--r-- | crypto/signature_creator_mac.cc | 4 | ||||
-rw-r--r-- | crypto/signature_verifier_mac.cc | 4 | ||||
-rw-r--r-- | crypto/signature_verifier_nss.cc | 2 | ||||
-rw-r--r-- | crypto/signature_verifier_win.cc | 2 | ||||
-rw-r--r-- | ipc/ipc_channel_win.cc | 2 | ||||
-rw-r--r-- | ipc/ipc_sync_channel.cc | 2 | ||||
-rw-r--r-- | ipc/ipc_sync_message_unittest.cc | 92 |
10 files changed, 87 insertions, 49 deletions
diff --git a/app/win/iat_patch_function.cc b/app/win/iat_patch_function.cc index a78a357..9abd6f2 100644 --- a/app/win/iat_patch_function.cc +++ b/app/win/iat_patch_function.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -215,7 +215,7 @@ IATPatchFunction::IATPatchFunction() IATPatchFunction::~IATPatchFunction() { if (NULL != intercept_function_) { DWORD error = Unpatch(); - DCHECK(error == NO_ERROR); + DCHECK_EQ(static_cast<DWORD>(NO_ERROR), error); } } @@ -256,7 +256,7 @@ DWORD IATPatchFunction::Unpatch() { DWORD error = RestoreImportedFunction(intercept_function_, original_function_, iat_thunk_); - DCHECK(NO_ERROR == error); + DCHECK_EQ(static_cast<DWORD>(NO_ERROR), error); // Hands off the intercept if we fail to unpatch. // If IATPatchFunction::Unpatch fails during RestoreImportedFunction diff --git a/base/at_exit.cc b/base/at_exit.cc index b7ab0a7..cafe75b 100644 --- a/base/at_exit.cc +++ b/base/at_exit.cc @@ -33,7 +33,7 @@ AtExitManager::~AtExitManager() { NOTREACHED() << "Tried to ~AtExitManager without an AtExitManager"; return; } - DCHECK(g_top_manager == this); + DCHECK_EQ(this, g_top_manager); ProcessCallbacksNow(); g_top_manager = next_manager_; diff --git a/crypto/cssm_init.cc b/crypto/cssm_init.cc index 5a5e3cc..23c2660 100644 --- a/crypto/cssm_init.cc +++ b/crypto/cssm_init.cc @@ -99,46 +99,46 @@ class CSSMInitSingleton { crtn = CSSM_ModuleAttach(&gGuidAppleCSP, &version, &cssmMemoryFunctions, 0, CSSM_SERVICE_CSP, 0, CSSM_KEY_HIERARCHY_NONE, NULL, 0, NULL, &csp_handle_); - DCHECK(crtn == CSSM_OK); + DCHECK_EQ(CSSM_OK, crtn); crtn = CSSM_ModuleAttach(&gGuidAppleX509CL, &version, &cssmMemoryFunctions, 0, CSSM_SERVICE_CL, 0, CSSM_KEY_HIERARCHY_NONE, NULL, 0, NULL, &cl_handle_); - DCHECK(crtn == CSSM_OK); + DCHECK_EQ(CSSM_OK, crtn); crtn = CSSM_ModuleAttach(&gGuidAppleX509TP, &version, &cssmMemoryFunctions, 0, CSSM_SERVICE_TP, 0, CSSM_KEY_HIERARCHY_NONE, NULL, 0, NULL, &tp_handle_); - DCHECK(crtn == CSSM_OK); + DCHECK_EQ(CSSM_OK, crtn); } ~CSSMInitSingleton() { CSSM_RETURN crtn; if (csp_handle_) { CSSM_RETURN crtn = CSSM_ModuleDetach(csp_handle_); - DCHECK(crtn == CSSM_OK); + DCHECK_EQ(CSSM_OK, crtn); } if (cl_handle_) { CSSM_RETURN crtn = CSSM_ModuleDetach(cl_handle_); - DCHECK(crtn == CSSM_OK); + DCHECK_EQ(CSSM_OK, crtn); } if (tp_handle_) { CSSM_RETURN crtn = CSSM_ModuleDetach(tp_handle_); - DCHECK(crtn == CSSM_OK); + DCHECK_EQ(CSSM_OK, crtn); } if (csp_loaded_) { crtn = CSSM_ModuleUnload(&gGuidAppleCSP, NULL, NULL); - DCHECK(crtn == CSSM_OK); + DCHECK_EQ(CSSM_OK, crtn); } if (cl_loaded_) { crtn = CSSM_ModuleUnload(&gGuidAppleX509CL, NULL, NULL); - DCHECK(crtn == CSSM_OK); + DCHECK_EQ(CSSM_OK, crtn); } if (tp_loaded_) { crtn = CSSM_ModuleUnload(&gGuidAppleX509TP, NULL, NULL); - DCHECK(crtn == CSSM_OK); + DCHECK_EQ(CSSM_OK, crtn); } if (inited_) { crtn = CSSM_Terminate(); - DCHECK(crtn == CSSM_OK); + DCHECK_EQ(CSSM_OK, crtn); } } diff --git a/crypto/signature_creator_mac.cc b/crypto/signature_creator_mac.cc index fa0bded..544c9fb 100644 --- a/crypto/signature_creator_mac.cc +++ b/crypto/signature_creator_mac.cc @@ -45,7 +45,7 @@ SignatureCreator::~SignatureCreator() { CSSM_RETURN crtn; if (sig_handle_) { crtn = CSSM_DeleteContext(sig_handle_); - DCHECK(crtn == CSSM_OK); + DCHECK_EQ(CSSM_OK, crtn); } } @@ -54,7 +54,7 @@ bool SignatureCreator::Update(const uint8* data_part, int data_part_len) { data.Data = const_cast<uint8*>(data_part); data.Length = data_part_len; CSSM_RETURN crtn = CSSM_SignDataUpdate(sig_handle_, &data, 1); - DCHECK(crtn == CSSM_OK); + DCHECK_EQ(CSSM_OK, crtn); return true; } diff --git a/crypto/signature_verifier_mac.cc b/crypto/signature_verifier_mac.cc index 33cdfcf..d442720 100644 --- a/crypto/signature_verifier_mac.cc +++ b/crypto/signature_verifier_mac.cc @@ -74,7 +74,7 @@ void SignatureVerifier::VerifyUpdate(const uint8* data_part, data.Data = const_cast<uint8*>(data_part); data.Length = data_part_len; CSSM_RETURN crtn = CSSM_VerifyDataUpdate(sig_handle_, &data, 1); - DCHECK(crtn == CSSM_OK); + DCHECK_EQ(CSSM_OK, crtn); } bool SignatureVerifier::VerifyFinal() { @@ -92,7 +92,7 @@ void SignatureVerifier::Reset() { CSSM_RETURN crtn; if (sig_handle_) { crtn = CSSM_DeleteContext(sig_handle_); - DCHECK(crtn == CSSM_OK); + DCHECK_EQ(CSSM_OK, crtn); sig_handle_ = 0; } signature_.clear(); diff --git a/crypto/signature_verifier_nss.cc b/crypto/signature_verifier_nss.cc index cf82785..8a7fd4f 100644 --- a/crypto/signature_verifier_nss.cc +++ b/crypto/signature_verifier_nss.cc @@ -90,7 +90,7 @@ bool SignatureVerifier::VerifyInit(const uint8* signature_algorithm, void SignatureVerifier::VerifyUpdate(const uint8* data_part, int data_part_len) { SECStatus rv = VFY_Update(vfy_context_, data_part, data_part_len); - DCHECK(rv == SECSuccess); + DCHECK_EQ(SECSuccess, rv); } bool SignatureVerifier::VerifyFinal() { diff --git a/crypto/signature_verifier_win.cc b/crypto/signature_verifier_win.cc index 8bf094f..d294c4d 100644 --- a/crypto/signature_verifier_win.cc +++ b/crypto/signature_verifier_win.cc @@ -90,7 +90,7 @@ bool SignatureVerifier::VerifyInit(const uint8* signature_algorithm, else if (!strcmp(signature_algorithm_id->pszObjId, szOID_RSA_MD5RSA)) hash_alg_id = CALG_MD5; free(signature_algorithm_id); - DCHECK(hash_alg_id != CALG_MD4); + DCHECK_NE(static_cast<ALG_ID>(CALG_MD4), hash_alg_id); if (hash_alg_id == CALG_MD4) return false; // Unsupported hash algorithm. } else if (GetLastError() == ERROR_FILE_NOT_FOUND) { diff --git a/ipc/ipc_channel_win.cc b/ipc/ipc_channel_win.cc index 9182200..be929b1 100644 --- a/ipc/ipc_channel_win.cc +++ b/ipc/ipc_channel_win.cc @@ -177,7 +177,7 @@ const std::wstring Channel::ChannelImpl::PipeName( bool Channel::ChannelImpl::CreatePipe(const IPC::ChannelHandle &channel_handle, Mode mode) { - DCHECK(pipe_ == INVALID_HANDLE_VALUE); + DCHECK_EQ(INVALID_HANDLE_VALUE, pipe_); const std::wstring pipe_name = PipeName(channel_handle.name); if (mode & MODE_SERVER_FLAG) { SECURITY_ATTRIBUTES security_attributes = {0}; diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc index 5cc4729..97e1c18 100644 --- a/ipc/ipc_sync_channel.cc +++ b/ipc/ipc_sync_channel.cc @@ -361,7 +361,7 @@ void SyncChannel::SyncContext::OnWaitableEventSignaled(WaitableEvent* event) { CancelPendingSends(); } else { // We got the reply, timed out or the process shutdown. - DCHECK(event == GetSendDoneEvent()); + DCHECK_EQ(GetSendDoneEvent(), event); MessageLoop::current()->QuitNow(); } } diff --git a/ipc/ipc_sync_message_unittest.cc b/ipc/ipc_sync_message_unittest.cc index 9a72aa3..7b513f7 100644 --- a/ipc/ipc_sync_message_unittest.cc +++ b/ipc/ipc_sync_message_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -38,7 +38,7 @@ class TestMessageReceiver { } void On_1_1(int in1, bool* out1) { - DCHECK(in1 == 1); + DCHECK_EQ(1, in1); *out1 = true; } @@ -49,44 +49,53 @@ class TestMessageReceiver { } void On_1_3(int in1, std::string* out1, int* out2, bool* out3) { - DCHECK(in1 == 3); + DCHECK_EQ(3, in1); *out1 = "1_3"; *out2 = 13; *out3 = false; } void On_2_1(int in1, bool in2, bool* out1) { - DCHECK(in1 == 1 && !in2); + DCHECK_EQ(1, in1); + DCHECK(!in2); *out1 = true; } void On_2_2(bool in1, int in2, bool* out1, int* out2) { - DCHECK(!in1 && in2 == 2); + DCHECK(!in1); + DCHECK_EQ(2, in2); *out1 = true; *out2 = 22; } void On_2_3(int in1, bool in2, std::string* out1, int* out2, bool* out3) { - DCHECK(in1 == 3 && in2); + DCHECK_EQ(3, in1); + DCHECK(in2); *out1 = "2_3"; *out2 = 23; *out3 = false; } void On_3_1(int in1, bool in2, std::string in3, bool* out1) { - DCHECK(in1 == 1 && !in2 && in3 == "3_1"); + DCHECK_EQ(1, in1); + DCHECK(!in2); + DCHECK_EQ("3_1", in3); *out1 = true; } void On_3_2(std::string in1, bool in2, int in3, bool* out1, int* out2) { - DCHECK(in1 == "3_2" && !in2 && in3 == 2); + DCHECK_EQ("3_2", in1); + DCHECK(!in2); + DCHECK_EQ(2, in3); *out1 = true; *out2 = 32; } void On_3_3(int in1, std::string in2, bool in3, std::string* out1, int* out2, bool* out3) { - DCHECK(in1 == 3 && in2 == "3_3" && in3); + DCHECK_EQ(3, in1); + DCHECK_EQ("3_3", in2); + DCHECK(in3); *out1 = "3_3"; *out2 = 33; *out3 = false; @@ -94,7 +103,9 @@ class TestMessageReceiver { void On_3_4(bool in1, int in2, std::string in3, int* out1, bool* out2, std::string* out3, bool* out4) { - DCHECK(in1 && in2 == 3 && in3 == "3_4"); + DCHECK(in1); + DCHECK_EQ(3, in2); + DCHECK_EQ("3_4", in3); *out1 = 34; *out2 = true; *out3 = "3_4"; @@ -171,10 +182,13 @@ TEST(IPCSyncMessageTest, Main) { DCHECK(!bool1); Send(new Msg_C_0_2(&bool1, &int1)); - DCHECK(bool1 && int1 == 2); + DCHECK(bool1); + DCHECK_EQ(2, int1); Send(new Msg_C_0_3(&bool1, &int1, &string1)); - DCHECK(!bool1 && int1 == 3 && string1 == "0_3"); + DCHECK(!bool1); + DCHECK_EQ(3, int1); + DCHECK_EQ("0_3", string1); bool1 = false; Send(new Msg_C_1_1(1, &bool1)); @@ -182,11 +196,14 @@ TEST(IPCSyncMessageTest, Main) { bool1 = false; Send(new Msg_C_1_2(false, &bool1, &int1)); - DCHECK(bool1 && int1 == 12); + DCHECK(bool1); + DCHECK_EQ(12, int1); bool1 = true; Send(new Msg_C_1_3(3, &string1, &int1, &bool1)); - DCHECK(string1 == "1_3" && int1 == 13 && !bool1); + DCHECK_EQ("1_3", string1); + DCHECK_EQ(13, int1); + DCHECK(!bool1); bool1 = false; Send(new Msg_C_2_1(1, false, &bool1)); @@ -194,11 +211,14 @@ TEST(IPCSyncMessageTest, Main) { bool1 = false; Send(new Msg_C_2_2(false, 2, &bool1, &int1)); - DCHECK(bool1 && int1 == 22); + DCHECK(bool1); + DCHECK_EQ(22, int1); bool1 = true; Send(new Msg_C_2_3(3, true, &string1, &int1, &bool1)); - DCHECK(string1 == "2_3" && int1 == 23 && !bool1); + DCHECK_EQ("2_3", string1); + DCHECK_EQ(23, int1); + DCHECK(!bool1); bool1 = false; Send(new Msg_C_3_1(1, false, "3_1", &bool1)); @@ -206,26 +226,35 @@ TEST(IPCSyncMessageTest, Main) { bool1 = false; Send(new Msg_C_3_2("3_2", false, 2, &bool1, &int1)); - DCHECK(bool1 && int1 == 32); + DCHECK(bool1); + DCHECK_EQ(32, int1); bool1 = true; Send(new Msg_C_3_3(3, "3_3", true, &string1, &int1, &bool1)); - DCHECK(string1 == "3_3" && int1 == 33 && !bool1); + DCHECK_EQ("3_3", string1); + DCHECK_EQ(33, int1); + DCHECK(!bool1); bool1 = false; bool bool2 = true; Send(new Msg_C_3_4(true, 3, "3_4", &int1, &bool1, &string1, &bool2)); - DCHECK(int1 == 34 && bool1 && string1 == "3_4" && !bool2); + DCHECK_EQ(34, int1); + DCHECK(bool1); + DCHECK_EQ("3_4", string1); + DCHECK(!bool2); // Routed messages, just a copy of the above but with extra routing paramater Send(new Msg_R_0_1(0, &bool1)); DCHECK(!bool1); Send(new Msg_R_0_2(0, &bool1, &int1)); - DCHECK(bool1 && int1 == 2); + DCHECK(bool1); + DCHECK_EQ(2, int1); Send(new Msg_R_0_3(0, &bool1, &int1, &string1)); - DCHECK(!bool1 && int1 == 3 && string1 == "0_3"); + DCHECK(!bool1); + DCHECK_EQ(3, int1); + DCHECK_EQ("0_3", string1); bool1 = false; Send(new Msg_R_1_1(0, 1, &bool1)); @@ -233,11 +262,14 @@ TEST(IPCSyncMessageTest, Main) { bool1 = false; Send(new Msg_R_1_2(0, false, &bool1, &int1)); - DCHECK(bool1 && int1 == 12); + DCHECK(bool1); + DCHECK_EQ(12, int1); bool1 = true; Send(new Msg_R_1_3(0, 3, &string1, &int1, &bool1)); - DCHECK(string1 == "1_3" && int1 == 13 && !bool1); + DCHECK_EQ("1_3", string1); + DCHECK_EQ(13, int1); + DCHECK(!bool1); bool1 = false; Send(new Msg_R_2_1(0, 1, false, &bool1)); @@ -245,11 +277,14 @@ TEST(IPCSyncMessageTest, Main) { bool1 = false; Send(new Msg_R_2_2(0, false, 2, &bool1, &int1)); - DCHECK(bool1 && int1 == 22); + DCHECK(bool1); + DCHECK_EQ(22, int1); bool1 = true; Send(new Msg_R_2_3(0, 3, true, &string1, &int1, &bool1)); - DCHECK(string1 == "2_3" && int1 == 23 && !bool1); + DCHECK(!bool1); + DCHECK_EQ("2_3", string1); + DCHECK_EQ(23, int1); bool1 = false; Send(new Msg_R_3_1(0, 1, false, "3_1", &bool1)); @@ -257,9 +292,12 @@ TEST(IPCSyncMessageTest, Main) { bool1 = false; Send(new Msg_R_3_2(0, "3_2", false, 2, &bool1, &int1)); - DCHECK(bool1 && int1 == 32); + DCHECK(bool1); + DCHECK_EQ(32, int1); bool1 = true; Send(new Msg_R_3_3(0, 3, "3_3", true, &string1, &int1, &bool1)); - DCHECK(string1 == "3_3" && int1 == 33 && !bool1); + DCHECK_EQ("3_3", string1); + DCHECK_EQ(33, int1); + DCHECK(!bool1); } |