summaryrefslogtreecommitdiffstats
path: root/net/socket/nss_ssl_util.cc
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-14 21:02:31 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-14 21:02:31 +0000
commit3aa4af04f4b8ba653e135d01988edcc783f296d7 (patch)
tree6014e603e7a3fbbc0fdb0ada6a51874e4a0814fb /net/socket/nss_ssl_util.cc
parent3031d8b7c9db7d26ce73961b8cb3b4ce125d6bc4 (diff)
downloadchromium_src-3aa4af04f4b8ba653e135d01988edcc783f296d7.zip
chromium_src-3aa4af04f4b8ba653e135d01988edcc783f296d7.tar.gz
chromium_src-3aa4af04f4b8ba653e135d01988edcc783f296d7.tar.bz2
NetLogEventParameter to Callback refactoring 9.
Get rid of all uses of NetLogEventParameters in net/socket. R=eroman@chromium.org BUG=126243 Review URL: https://chromiumcodereview.appspot.com/10546162 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142224 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/nss_ssl_util.cc')
-rw-r--r--net/socket/nss_ssl_util.cc49
1 files changed, 20 insertions, 29 deletions
diff --git a/net/socket/nss_ssl_util.cc b/net/socket/nss_ssl_util.cc
index b92600a..d262f93 100644
--- a/net/socket/nss_ssl_util.cc
+++ b/net/socket/nss_ssl_util.cc
@@ -11,6 +11,7 @@
#include <string>
+#include "base/bind.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/singleton.h"
@@ -220,41 +221,31 @@ int MapNSSError(PRErrorCode err) {
}
}
-// Extra parameters to attach to the NetLog when we receive an error in response
-// to a call to an NSS function. Used instead of SSLErrorParams with
-// events of type TYPE_SSL_NSS_ERROR. Automatically looks up last PR error.
-class SSLFailedNSSFunctionParams : public NetLog::EventParameters {
- public:
- // |param| is ignored if it has a length of 0.
- SSLFailedNSSFunctionParams(const std::string& function,
- const std::string& param)
- : function_(function), param_(param), ssl_lib_error_(PR_GetError()) {
- }
-
- virtual Value* ToValue() const {
- DictionaryValue* dict = new DictionaryValue();
- dict->SetString("function", function_);
- if (!param_.empty())
- dict->SetString("param", param_);
- dict->SetInteger("ssl_lib_error", ssl_lib_error_);
- return dict;
- }
-
- protected:
- virtual ~SSLFailedNSSFunctionParams() {}
-
- private:
- const std::string function_;
- const std::string param_;
- const PRErrorCode ssl_lib_error_;
-};
+// Returns parameters to attach to the NetLog when we receive an error in
+// response to a call to an NSS function. Used instead of
+// NetLogSSLErrorCallback with events of type TYPE_SSL_NSS_ERROR.
+Value* NetLogSSLFailedNSSFunctionCallback(
+ const char* function,
+ const char* param,
+ int ssl_lib_error,
+ NetLog::LogLevel /* log_level */) {
+ DictionaryValue* dict = new DictionaryValue();
+ dict->SetString("function", function);
+ if (param[0] != '\0')
+ dict->SetString("param", param);
+ dict->SetInteger("ssl_lib_error", ssl_lib_error);
+ return dict;
+}
void LogFailedNSSFunction(const BoundNetLog& net_log,
const char* function,
const char* param) {
+ DCHECK(function);
+ DCHECK(param);
net_log.AddEvent(
NetLog::TYPE_SSL_NSS_ERROR,
- make_scoped_refptr(new SSLFailedNSSFunctionParams(function, param)));
+ base::Bind(&NetLogSSLFailedNSSFunctionCallback,
+ function, param, PR_GetError()));
}
} // namespace net