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

Side by Side Diff: chrome/browser/net/url_request_tracking.cc

Issue 5384002: net: Remove typedef net::URLRequest URLRequest; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/net/url_request_tracking.h" 5 #include "chrome/browser/net/url_request_tracking.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "net/url_request/url_request.h" 8 #include "net/url_request/url_request.h"
9 9
10 namespace { 10 namespace {
11 11
12 // The value is not important, this address is used as the unique key for the 12 // The value is not important, this address is used as the unique key for the
13 // PID. 13 // PID.
14 const void* kOriginProcessUniqueIDKey = 0; 14 const void* kOriginProcessUniqueIDKey = 0;
15 15
16 class UniqueIDData : public URLRequest::UserData { 16 class UniqueIDData : public net::URLRequest::UserData {
17 public: 17 public:
18 explicit UniqueIDData(int id) : id_(id) {} 18 explicit UniqueIDData(int id) : id_(id) {}
19 virtual ~UniqueIDData() {} 19 virtual ~UniqueIDData() {}
20 20
21 int id() const { return id_; } 21 int id() const { return id_; }
22 void set_id(int id) { id_ = id; } 22 void set_id(int id) { id_ = id; }
23 23
24 private: 24 private:
25 int id_; 25 int id_;
26 26
27 DISALLOW_COPY_AND_ASSIGN(UniqueIDData); 27 DISALLOW_COPY_AND_ASSIGN(UniqueIDData);
28 }; 28 };
29 29
30 } // namespace 30 } // namespace
31 31
32 namespace chrome_browser_net { 32 namespace chrome_browser_net {
33 33
34 void SetOriginProcessUniqueIDForRequest(int id, URLRequest* request) { 34 void SetOriginProcessUniqueIDForRequest(int id, net::URLRequest* request) {
35 // The request will take ownership. 35 // The request will take ownership.
36 request->SetUserData(&kOriginProcessUniqueIDKey, new UniqueIDData(id)); 36 request->SetUserData(&kOriginProcessUniqueIDKey, new UniqueIDData(id));
37 } 37 }
38 38
39 int GetOriginProcessUniqueIDForRequest(const URLRequest* request) { 39 int GetOriginProcessUniqueIDForRequest(const net::URLRequest* request) {
40 const UniqueIDData* data = static_cast<const UniqueIDData*>( 40 const UniqueIDData* data = static_cast<const UniqueIDData*>(
41 request->GetUserData(&kOriginProcessUniqueIDKey)); 41 request->GetUserData(&kOriginProcessUniqueIDKey));
42 if (!data) 42 if (!data)
43 return -1; 43 return -1;
44 return data->id(); 44 return data->id();
45 } 45 }
46 46
47 } // namespace chrome_browser_net 47 } // namespace chrome_browser_net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698