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

Unified Diff: services/ui/demo/mus_demo.h

Issue 2503923003: Demonstrate external-window-mode in mus-demo (Closed)
Patch Set: Wrap comment 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 side-by-side diff with in-line comments
Download patch
Index: services/ui/demo/mus_demo.h
diff --git a/services/ui/demo/mus_demo.h b/services/ui/demo/mus_demo.h
index 941b2387be42874fd4287f2006f32215ba625cf4..faddf96a5bc38ed20457327293e8b9af11377af1 100644
--- a/services/ui/demo/mus_demo.h
+++ b/services/ui/demo/mus_demo.h
@@ -17,11 +17,11 @@
#include "services/service_manager/public/cpp/service.h"
#include "services/ui/public/cpp/window_manager_delegate.h"
#include "services/ui/public/cpp/window_tree_client_delegate.h"
+#include "services/ui/public/interfaces/window_tree_host.mojom.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/display/screen_base.h"
namespace ui {
-class BitmapUploader;
class GpuService;
namespace demo {
@@ -37,6 +37,8 @@ class MusDemo : public service_manager::Service,
~MusDemo() override;
private:
+ struct WindowTreeData;
+
// service_manager::Service:
void OnStart() override;
bool OnConnect(const service_manager::ServiceInfo& remote_info,
@@ -69,33 +71,24 @@ class MusDemo : public service_manager::Service,
const base::Callback<void(bool)>& on_done) override;
void OnWmCancelMoveLoop(Window* window) override;
- // Allocate a bitmap the same size as the window to draw into.
- void AllocBitmap();
+ // Creates a new WindowTreeHost and adds its context to |window_tree_datas_|.
+ void AddWindowTreeHost();
+
+ // Sets up a timer to regularly draw frames to |window|.
+ void BeginDrawingFrames(Window* window);
// Draws one frame, incrementing the rotation angle.
- void DrawFrame();
+ void DrawFrame(WindowTreeData* data);
+
+ bool external_window_mode_;
- Window* window_ = nullptr;
- std::unique_ptr<WindowTreeClient> window_tree_client_;
std::unique_ptr<GpuService> gpu_service_;
// Dummy screen required to be the screen instance.
std::unique_ptr<display::ScreenBase> screen_;
- // Used to send frames to mus.
- std::unique_ptr<BitmapUploader> uploader_;
-
- // Bitmap that is the same size as our client window area.
- SkBitmap bitmap_;
-
- // Timer for calling DrawFrame().
- base::RepeatingTimer timer_;
-
- // Current rotation angle for drawing.
- double angle_ = 0.0;
-
- // Last time a frame was drawn.
- base::TimeTicks last_draw_frame_time_;
+ // One WindowTreeData for each WindowTreeHost.
+ std::vector<std::unique_ptr<WindowTreeData>> window_tree_datas_;
DISALLOW_COPY_AND_ASSIGN(MusDemo);
};

Powered by Google App Engine
This is Rietveld 408576698