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

Side by Side Diff: content/browser/devtools/protocol/emulation_handler.h

Issue 2411793008: Adds BeginFrameControl via DevTools.
Patch Set: BFC prototype v2 with allow_latency_opts and waiting for BFOs. Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_ 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "cc/scheduler/begin_frame_source.h"
10 #include "cc/surfaces/frame_sink_id.h"
9 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" 11 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h"
10 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" 12 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h"
11 13
12 namespace content { 14 namespace content {
13 15
14 class RenderFrameHostImpl; 16 class RenderFrameHostImpl;
15 class WebContentsImpl; 17 class WebContentsImpl;
16 18
17 namespace devtools { 19 namespace devtools {
18 20
19 namespace page { class PageHandler; } 21 namespace page { class PageHandler; }
20 22
21 namespace emulation { 23 namespace emulation {
22 24
23 class EmulationHandler { 25 class EmulatedBeginFrameSource;
26
27 class EmulationHandler : public cc::ExternalBeginFrameSourceClient {
24 public: 28 public:
25 using Response = DevToolsProtocolClient::Response; 29 using Response = DevToolsProtocolClient::Response;
26 30
27 EmulationHandler(); 31 EmulationHandler();
28 ~EmulationHandler(); 32 ~EmulationHandler();
29 33
30 void SetRenderFrameHost(RenderFrameHostImpl* host); 34 void SetRenderFrameHost(RenderFrameHostImpl* host);
31 void SetClient(std::unique_ptr<Client> client) { } 35 void SetClient(std::unique_ptr<Client> client);
32 void Detached(); 36 void Detached();
33 37
34 Response SetGeolocationOverride(double* latitude, 38 Response SetGeolocationOverride(double* latitude,
35 double* longitude, 39 double* longitude,
36 double* accuracy); 40 double* accuracy);
37 Response ClearGeolocationOverride(); 41 Response ClearGeolocationOverride();
38 42
39 Response SetTouchEmulationEnabled(bool enabled, 43 Response SetTouchEmulationEnabled(bool enabled,
40 const std::string* configuration); 44 const std::string* configuration);
41 45
(...skipping 18 matching lines...) Expand all
60 64
61 Response ForceViewport(double x, double y, double scale); 65 Response ForceViewport(double x, double y, double scale);
62 Response ResetViewport(); 66 Response ResetViewport();
63 Response ResetPageScaleFactor(); 67 Response ResetPageScaleFactor();
64 Response SetPageScaleFactor(double page_scale_factor); 68 Response SetPageScaleFactor(double page_scale_factor);
65 Response SetScriptExecutionDisabled(bool disabled); 69 Response SetScriptExecutionDisabled(bool disabled);
66 Response SetEmulatedMedia(const std::string& media); 70 Response SetEmulatedMedia(const std::string& media);
67 Response SetCPUThrottlingRate(double rate); 71 Response SetCPUThrottlingRate(double rate);
68 Response SetVirtualTimePolicy(const std::string& policy, const int* budget); 72 Response SetVirtualTimePolicy(const std::string& policy, const int* budget);
69 73
74 Response EnableBeginFrameControl();
75 Response DisableBeginFrameControl();
76 Response SendBeginFrame(double interval,
77 const double* frame_time,
78 const double* deadline,
79 std::string* out_frame_id);
80
81 void IssueBeginFrameOnSource(const cc::BeginFrameArgs& args);
82
83 // cc::ExternalBeginFrameSourceClient implementation:
84 void OnNeedsBeginFrames(bool needs_begin_frames) override;
85
70 private: 86 private:
87 void ClientSetNeedsBeginFrame(bool needs_begin_frame);
88 void ClientFrameCommitted(const std::string& frame_id);
89
71 WebContentsImpl* GetWebContents(); 90 WebContentsImpl* GetWebContents();
72 void UpdateTouchEventEmulationState(); 91 void UpdateTouchEventEmulationState();
73 void UpdateDeviceEmulationState(); 92 void UpdateDeviceEmulationState();
74 93
75 bool touch_emulation_enabled_; 94 bool touch_emulation_enabled_;
76 std::string touch_emulation_configuration_; 95 std::string touch_emulation_configuration_;
77 96
78 bool device_emulation_enabled_; 97 bool device_emulation_enabled_;
79 blink::WebDeviceEmulationParams device_emulation_params_; 98 blink::WebDeviceEmulationParams device_emulation_params_;
80 99
100 EmulatedBeginFrameSource* begin_frame_source_; // Not owned.
101 std::unique_ptr<cc::BeginFrameSource> original_begin_frame_source_;
102 bool needs_begin_frame_;
103
81 RenderFrameHostImpl* host_; 104 RenderFrameHostImpl* host_;
105 std::unique_ptr<Client> client_;
106 base::WeakPtrFactory<EmulationHandler> weak_factory_;
82 107
83 DISALLOW_COPY_AND_ASSIGN(EmulationHandler); 108 DISALLOW_COPY_AND_ASSIGN(EmulationHandler);
84 }; 109 };
85 110
86 } // namespace emulation 111 } // namespace emulation
87 } // namespace devtools 112 } // namespace devtools
88 } // namespace content 113 } // namespace content
89 114
90 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_ 115 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_EMULATION_HANDLER_H_
OLDNEW
« no previous file with comments | « content/browser/compositor/gpu_process_transport_factory.cc ('k') | content/browser/devtools/protocol/emulation_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698