summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/url_request_tracking.h
blob: c0a3e9eb1b312ca3c83640d51f07053f9b299cb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_NET_URL_REQUEST_TRACKING_H_
#define CHROME_BROWSER_NET_URL_REQUEST_TRACKING_H_

class URLRequest;

namespace chrome_browser_net {

// Sets the given ID on the given request for later retrieval. This information
// duplicates a field in the ResourceDispatcherHost's user data, but is also
// set for non-ResourceDispatcher-related requests. Having this one global
// place allows us to do more general things, such as assigning traffic for the
// network view in the task manager.
//
// If you make a request on behalf of a child process, please call this
// function. The default value will be -1 which will be interprepreted as
// originating from the browser itself.
//
// The ID is the child process' unique ID (not a PID) of the process originating
// the request. This is normally the renderer corresponding to the load. If a
// plugin process does a request through a renderer process this will be the
// plugin (the originator of the request).
void SetOriginProcessUniqueIDForRequest(int id, URLRequest* request);

// Returns the child process' unique ID that has been previously set by
// SetOriginProcessUniqueIDForRequest. If no ID has been set, the return
// value is -1. We use this to identify requests made by the browser process.
int GetOriginProcessUniqueIDForRequest(const URLRequest* request);

}  // namespace chrome_browser_net

#endif  // CHROME_BROWSER_NET_URL_REQUEST_TRACKING_H_