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

Unified Diff: net/socket/nss_ssl_util.cc

Issue 10546162: NetLogEventParameter to Callback refactoring 9. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Remove comment Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/client_socket_pool_base.cc ('k') | net/socket/socket_error_params.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/nss_ssl_util.cc
===================================================================
--- net/socket/nss_ssl_util.cc (revision 142108)
+++ net/socket/nss_ssl_util.cc (working copy)
@@ -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 @@
}
}
-// 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()) {
- }
+// 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;
+}
- 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_;
-};
-
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
« no previous file with comments | « net/socket/client_socket_pool_base.cc ('k') | net/socket/socket_error_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698