| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_SCHEDULER_RENDERER_RENDER_WIDGET_SIGNALS_H_ | |
| 6 #define COMPONENTS_SCHEDULER_RENDERER_RENDER_WIDGET_SIGNALS_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/trace_event/trace_event.h" | |
| 11 #include "base/trace_event/trace_event_argument.h" | |
| 12 #include "components/scheduler/scheduler_export.h" | |
| 13 | |
| 14 namespace scheduler { | |
| 15 | |
| 16 class RenderWidgetSchedulingState; | |
| 17 | |
| 18 class SCHEDULER_EXPORT RenderWidgetSignals { | |
| 19 public: | |
| 20 class SCHEDULER_EXPORT Observer { | |
| 21 public: | |
| 22 virtual ~Observer() {} | |
| 23 | |
| 24 // If |hidden| is true then all render widgets managed by this renderer | |
| 25 // process have been hidden. | |
| 26 // If |hidden| is false at least one render widget managed by this renderer | |
| 27 // process has become visible and the renderer is no longer hidden. | |
| 28 // Will be called on the main thread. | |
| 29 virtual void SetAllRenderWidgetsHidden(bool hidden) = 0; | |
| 30 | |
| 31 // Tells the observer whether or not we have at least one touch handler on | |
| 32 // a visible render widget. Will be called on the main thread. | |
| 33 virtual void SetHasVisibleRenderWidgetWithTouchHandler( | |
| 34 bool has_visible_render_widget_with_touch_handler) = 0; | |
| 35 }; | |
| 36 | |
| 37 explicit RenderWidgetSignals(Observer* observer); | |
| 38 | |
| 39 std::unique_ptr<RenderWidgetSchedulingState> NewRenderWidgetSchedulingState(); | |
| 40 | |
| 41 void AsValueInto(base::trace_event::TracedValue* state) const; | |
| 42 | |
| 43 private: | |
| 44 friend class RenderWidgetSchedulingState; | |
| 45 | |
| 46 void IncNumVisibleRenderWidgets(); | |
| 47 void DecNumVisibleRenderWidgets(); | |
| 48 void IncNumVisibleRenderWidgetsWithTouchHandlers(); | |
| 49 void DecNumVisibleRenderWidgetsWithTouchHandlers(); | |
| 50 | |
| 51 Observer* observer_; // NOT OWNED | |
| 52 int num_visible_render_widgets_; | |
| 53 int num_visible_render_widgets_with_touch_handlers_; | |
| 54 }; | |
| 55 | |
| 56 } // namespace scheduler | |
| 57 | |
| 58 #endif // COMPONENTS_SCHEDULER_RENDERER_RENDER_WIDGET_SIGNALS_H_ | |
| OLD | NEW |