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

Side by Side Diff: services/ui/demo/mus_demo.cc

Issue 2233003003: services/ui: Inject GpuService instance where needed, instead of singleton. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 months 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
« no previous file with comments | « services/ui/common/gpu_service.cc ('k') | services/ui/public/cpp/bitmap_uploader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "services/ui/demo/mus_demo.h" 5 #include "services/ui/demo/mus_demo.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "services/shell/public/cpp/connector.h" 8 #include "services/shell/public/cpp/connector.h"
9 #include "services/ui/common/gpu_service.h" 9 #include "services/ui/common/gpu_service.h"
10 #include "services/ui/public/cpp/bitmap_uploader.h" 10 #include "services/ui/public/cpp/bitmap_uploader.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 const std::set<Window*>& client_windows, 109 const std::set<Window*>& client_windows,
110 bool janky) { 110 bool janky) {
111 // Don't care 111 // Don't care
112 } 112 }
113 113
114 void MusDemo::OnWmNewDisplay(Window* window, const display::Display& display) { 114 void MusDemo::OnWmNewDisplay(Window* window, const display::Display& display) {
115 DCHECK(!window_); // Only support one display. 115 DCHECK(!window_); // Only support one display.
116 window_ = window; 116 window_ = window;
117 117
118 // Initialize bitmap uploader for sending frames to MUS. 118 // Initialize bitmap uploader for sending frames to MUS.
119 uploader_.reset(new ui::BitmapUploader(window_)); 119 uploader_.reset(new ui::BitmapUploader(window_, gpu_service_.get()));
120 uploader_->Init(); 120 uploader_->Init();
121 121
122 // Draw initial frame and start the timer to regularly draw frames. 122 // Draw initial frame and start the timer to regularly draw frames.
123 DrawFrame(); 123 DrawFrame();
124 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameDelay), 124 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameDelay),
125 base::Bind(&MusDemo::DrawFrame, base::Unretained(this))); 125 base::Bind(&MusDemo::DrawFrame, base::Unretained(this)));
126 } 126 }
127 127
128 void MusDemo::OnWmPerformMoveLoop(Window* window, 128 void MusDemo::OnWmPerformMoveLoop(Window* window,
129 mojom::MoveLoopSource source, 129 mojom::MoveLoopSource source,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 new std::vector<unsigned char>(addr, addr + bytes)); 175 new std::vector<unsigned char>(addr, addr + bytes));
176 bitmap_.unlockPixels(); 176 bitmap_.unlockPixels();
177 177
178 // Send frame to MUS via BitmapUploader. 178 // Send frame to MUS via BitmapUploader.
179 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), 179 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data),
180 ui::BitmapUploader::BGRA); 180 ui::BitmapUploader::BGRA);
181 } 181 }
182 182
183 } // namespace demo 183 } // namespace demo
184 } // namespace ui 184 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/common/gpu_service.cc ('k') | services/ui/public/cpp/bitmap_uploader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698