Make sure webrtc::VideoSourceInterface is released on the main render thread.
[chromium-blink-merge.git] / content / public / browser / resource_throttle.h
blob469782d9dfd0d2c7ef06321f94438d474ea3385d
1 // Copyright (c) 2012 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.
5 #ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_THROTTLE_H_
6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_THROTTLE_H_
8 #include <vector>
10 class GURL;
12 namespace content {
14 class ResourceController;
16 // A ResourceThrottle gets notified at various points during the process of
17 // loading a resource. At each stage, it has the opportunity to defer the
18 // resource load. The ResourceController interface may be used to resume a
19 // deferred resource load, or it may be used to cancel a resource load at any
20 // time.
21 class ResourceThrottle {
22 public:
23 virtual ~ResourceThrottle() {}
25 virtual void WillStartRequest(bool* defer) {}
26 virtual void WillRedirectRequest(const GURL& new_url, bool* defer) {}
27 virtual void WillProcessResponse(bool* defer) {}
28 virtual void OnBeforeNetworkStart(bool* defer) {}
30 // Returns the name of the throttle, as a UTF-8 C-string, for logging
31 // purposes. NULL is not allowed. Caller does *not* take ownership of the
32 // returned string.
33 virtual const char* GetNameForLogging() const = 0;
35 void set_controller_for_testing(ResourceController* c) {
36 controller_ = c;
39 protected:
40 ResourceThrottle() : controller_(NULL) {}
41 ResourceController* controller() { return controller_; }
43 private:
44 friend class ThrottlingResourceHandler;
45 void set_controller(ResourceController* c) { controller_ = c; }
47 ResourceController* controller_;
50 } // namespace content
52 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_THROTTLE_H_