diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-12 18:29:43 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-12 18:29:43 +0000 |
commit | fe57c8c948f71b1990b91324870184d28ffd334f (patch) | |
tree | 03e3b6244478a6e40dad845631f4c92f02a2c160 /net/url_request | |
parent | 6b4c5f226478196065927e852fc581e2e5df4227 (diff) | |
download | chromium_src-fe57c8c948f71b1990b91324870184d28ffd334f.zip chromium_src-fe57c8c948f71b1990b91324870184d28ffd334f.tar.gz chromium_src-fe57c8c948f71b1990b91324870184d28ffd334f.tar.bz2 |
Annotate some network classes as non-threadsafe.
This is a defensive change to catch attempts to delete them on a different thread than where they were created (when in Debug mode).
Although most classes in net are not thread safe and could be annotated, I chose to annotate these specific ones since they are frequently the top-level objects held by embedders.
Review URL: http://codereview.chromium.org/1812007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r-- | net/url_request/url_request.h | 3 | ||||
-rw-r--r-- | net/url_request/url_request_context.h | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index 68b822c..59aa9c4 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h @@ -13,6 +13,7 @@ #include "base/linked_list.h" #include "base/linked_ptr.h" #include "base/logging.h" +#include "base/non_thread_safe.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "googleurl/src/gurl.h" @@ -54,7 +55,7 @@ typedef std::vector<std::string> ResponseCookies; // // NOTE: All usage of all instances of this class should be on the same thread. // -class URLRequest { +class URLRequest : public NonThreadSafe { public: // Derive from this class and add your own data members to associate extra // information with a URLRequest. Use GetUserData(key) and SetUserData() diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h index 51a6066..0f7fd51 100644 --- a/net/url_request/url_request_context.h +++ b/net/url_request/url_request_context.h @@ -10,6 +10,7 @@ #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ +#include "base/non_thread_safe.h" #include "base/ref_counted.h" #include "base/string_util.h" #include "net/base/cookie_store.h" @@ -32,7 +33,8 @@ class URLRequest; // Subclass to provide application-specific context for URLRequest instances. class URLRequestContext - : public base::RefCountedThreadSafe<URLRequestContext> { + : public base::RefCountedThreadSafe<URLRequestContext>, + public NonThreadSafe { public: URLRequestContext() : net_log_(NULL), |