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

Side by Side Diff: components/mus/demo/mus_demo.cc

Issue 1906623003: Convert //components/mus from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « components/mus/demo/mus_demo.h ('k') | components/mus/gles2/command_buffer_driver.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 "components/mus/demo/mus_demo.h" 5 #include "components/mus/demo/mus_demo.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "components/bitmap_uploader/bitmap_uploader.h" 8 #include "components/bitmap_uploader/bitmap_uploader.h"
9 #include "components/mus/public/cpp/window_tree_host_factory.h" 9 #include "components/mus/public/cpp/window_tree_host_factory.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 91 }
92 92
93 void MusDemo::SetWindowManagerClient(mus::WindowManagerClient* client) {} 93 void MusDemo::SetWindowManagerClient(mus::WindowManagerClient* client) {}
94 94
95 bool MusDemo::OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) { 95 bool MusDemo::OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) {
96 return true; 96 return true;
97 } 97 }
98 98
99 bool MusDemo::OnWmSetProperty(mus::Window* window, 99 bool MusDemo::OnWmSetProperty(mus::Window* window,
100 const std::string& name, 100 const std::string& name,
101 scoped_ptr<std::vector<uint8_t>>* new_data) { 101 std::unique_ptr<std::vector<uint8_t>>* new_data) {
102 return true; 102 return true;
103 } 103 }
104 104
105 mus::Window* MusDemo::OnWmCreateTopLevelWindow( 105 mus::Window* MusDemo::OnWmCreateTopLevelWindow(
106 std::map<std::string, std::vector<uint8_t>>* properties) { 106 std::map<std::string, std::vector<uint8_t>>* properties) {
107 // TODO(kylechar): Check if this should return something useful. 107 // TODO(kylechar): Check if this should return something useful.
108 return nullptr; 108 return nullptr;
109 } 109 }
110 110
111 void MusDemo::OnAccelerator(uint32_t id, const ui::Event& event) {} 111 void MusDemo::OnAccelerator(uint32_t id, const ui::Event& event) {}
(...skipping 28 matching lines...) Expand all
140 DrawSquare(bounds, angle_, &canvas); 140 DrawSquare(bounds, angle_, &canvas);
141 canvas.flush(); 141 canvas.flush();
142 142
143 // Copy pixels data into vector that will be passed to BitmapUploader. 143 // Copy pixels data into vector that will be passed to BitmapUploader.
144 // TODO(rjkroege): Make a 1/0-copy bitmap uploader for the contents of a 144 // TODO(rjkroege): Make a 1/0-copy bitmap uploader for the contents of a
145 // SkBitmap. 145 // SkBitmap.
146 bitmap_.lockPixels(); 146 bitmap_.lockPixels();
147 const unsigned char* addr = 147 const unsigned char* addr =
148 static_cast<const unsigned char*>(bitmap_.getPixels()); 148 static_cast<const unsigned char*>(bitmap_.getPixels());
149 const int bytes = bounds.width() * bounds.height() * 4; 149 const int bytes = bounds.width() * bounds.height() * 4;
150 scoped_ptr<std::vector<unsigned char>> data( 150 std::unique_ptr<std::vector<unsigned char>> data(
151 new std::vector<unsigned char>(addr, addr + bytes)); 151 new std::vector<unsigned char>(addr, addr + bytes));
152 bitmap_.unlockPixels(); 152 bitmap_.unlockPixels();
153 153
154 // Send frame to MUS via BitmapUploader. 154 // Send frame to MUS via BitmapUploader.
155 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), 155 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data),
156 bitmap_uploader::BitmapUploader::BGRA); 156 bitmap_uploader::BitmapUploader::BGRA);
157 } 157 }
158 158
159 } // namespace mus_demo 159 } // namespace mus_demo
OLDNEW
« no previous file with comments | « components/mus/demo/mus_demo.h ('k') | components/mus/gles2/command_buffer_driver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698