Chromium Code Reviews| Index: chrome/browser/renderer_host/thread_hop_resource_throttle.h |
| diff --git a/chrome/browser/renderer_host/thread_hop_resource_throttle.h b/chrome/browser/renderer_host/thread_hop_resource_throttle.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..25d90b5cbf7693733a56c47c555ec3934245daaf |
| --- /dev/null |
| +++ b/chrome/browser/renderer_host/thread_hop_resource_throttle.h |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2015 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_RENDERER_HOST_THREAD_HOP_RESOURCE_THROTTLE_H_ |
| +#define CHROME_BROWSER_RENDERER_HOST_THREAD_HOP_RESOURCE_THROTTLE_H_ |
| + |
| +#include "content/public/browser/resource_throttle.h" |
| + |
|
mmenke
2015/10/01 21:37:33
nit: Remove blank line.
davidben
2015/10/01 22:06:25
Derp. Done.
|
| +#include "base/memory/weak_ptr.h" |
| + |
| +namespace base { |
| +class TimeTicks; |
| +} |
| + |
| +// A ResourceThrottle which defers request start, redirect, and response |
| +// completion on an IO to UI to IO round-trip. This throttle will be added on a |
| +// field trial to determine the cost of making some resource-related decisions |
| +// on the UI thread. See https://crbug.com/524228. |
| +class ThreadHopResourceThrottle : public content::ResourceThrottle { |
| + public: |
| + ThreadHopResourceThrottle(); |
| + ~ThreadHopResourceThrottle() override; |
| + |
| + static bool IsEnabled(); |
| + |
| + // content::ResourceThrottle implementation: |
| + void WillStartRequest(bool* defer) override; |
| + void WillRedirectRequest(const net::RedirectInfo& redirect_info, |
| + bool* defer) override; |
| + void WillProcessResponse(bool* defer) override; |
| + const char* GetNameForLogging() const override; |
| + |
| + private: |
| + void ResumeAfterThreadHop(); |
| + void Resume(const base::TimeTicks& time); |
| + |
| + base::WeakPtrFactory<ThreadHopResourceThrottle> weak_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ThreadHopResourceThrottle); |
|
mmenke
2015/10/01 21:37:33
include macros.h?
davidben
2015/10/01 22:06:25
Done.
|
| +}; |
| + |
| +#endif // CHROME_BROWSER_RENDERER_HOST_THREAD_HOP_RESOURCE_THROTTLE_H_ |