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

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

Issue 7054023: Get rid of url_request_tracking.*. The only other place that used it other than ResourceDispatch... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/net/url_request_tracking.h ('k') | chrome/browser/plugin_download_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/net/url_request_tracking.h"
6
7 #include "base/basictypes.h"
8 #include "net/url_request/url_request.h"
9
10 namespace {
11
12 // The value is not important, this address is used as the unique key for the
13 // PID.
14 const void* kOriginPidKey = 0;
15
16 class OriginPidData : public net::URLRequest::UserData {
17 public:
18 explicit OriginPidData(int pid) : pid_(pid) {}
19 virtual ~OriginPidData() {}
20
21 int pid() const { return pid_; }
22 void set_pid(int pid) { pid_ = pid; }
23
24 private:
25 int pid_;
26
27 DISALLOW_COPY_AND_ASSIGN(OriginPidData);
28 };
29
30 } // namespace
31
32 namespace chrome_browser_net {
33
34 void SetOriginPIDForRequest(int pid, net::URLRequest* request) {
35 // The request will take ownership.
36 request->SetUserData(&kOriginPidKey, new OriginPidData(pid));
37 }
38
39 int GetOriginPIDForRequest(const net::URLRequest* request) {
40 const OriginPidData* data = static_cast<const OriginPidData*>(
41 request->GetUserData(&kOriginPidKey));
42 if (!data)
43 return 0;
44 return data->pid();
45 }
46
47 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/net/url_request_tracking.h ('k') | chrome/browser/plugin_download_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698