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

Side by Side Diff: content/renderer/pepper/pepper_graphics_2d_host_unittest.cc

Issue 1873783003: Convert //content/renderer 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/pepper/pepper_graphics_2d_host.h" 5 #include "content/renderer/pepper/pepper_graphics_2d_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 void Flush() { 66 void Flush() {
67 ppapi::host::HostMessageContext context( 67 ppapi::host::HostMessageContext context(
68 ppapi::proxy::ResourceMessageCallParams(host_->pp_resource(), 0)); 68 ppapi::proxy::ResourceMessageCallParams(host_->pp_resource(), 0));
69 host_->OnHostMsgFlush(&context); 69 host_->OnHostMsgFlush(&context);
70 host_->ViewInitiatedPaint(); 70 host_->ViewInitiatedPaint();
71 host_->SendOffscreenFlushAck(); 71 host_->SendOffscreenFlushAck();
72 } 72 }
73 73
74 void PaintToWebCanvas(SkBitmap* bitmap) { 74 void PaintToWebCanvas(SkBitmap* bitmap) {
75 scoped_ptr<WebCanvas> canvas(new WebCanvas(*bitmap)); 75 std::unique_ptr<WebCanvas> canvas(new WebCanvas(*bitmap));
76 gfx::Rect plugin_rect(PP_ToGfxRect(renderer_view_data_.rect)); 76 gfx::Rect plugin_rect(PP_ToGfxRect(renderer_view_data_.rect));
77 host_->Paint(canvas.get(), 77 host_->Paint(canvas.get(),
78 plugin_rect, 78 plugin_rect,
79 gfx::Rect(0, 0, plugin_rect.width(), plugin_rect.height())); 79 gfx::Rect(0, 0, plugin_rect.width(), plugin_rect.height()));
80 } 80 }
81 81
82 void ResetPageBitmap(SkBitmap* bitmap) { 82 void ResetPageBitmap(SkBitmap* bitmap) {
83 PP_Rect plugin_rect = renderer_view_data_.rect; 83 PP_Rect plugin_rect = renderer_view_data_.rect;
84 int width = plugin_rect.point.x + plugin_rect.size.width; 84 int width = plugin_rect.point.x + plugin_rect.size.width;
85 int height = plugin_rect.point.y + plugin_rect.size.height; 85 int height = plugin_rect.point.y + plugin_rect.size.height;
86 if (bitmap->isNull() || bitmap->width() != width || 86 if (bitmap->isNull() || bitmap->width() != width ||
87 bitmap->height() != height) { 87 bitmap->height() != height) {
88 bitmap->allocN32Pixels(width, height); 88 bitmap->allocN32Pixels(width, height);
89 } 89 }
90 bitmap->eraseColor(0); 90 bitmap->eraseColor(0);
91 } 91 }
92 92
93 private: 93 private:
94 ppapi::ViewData renderer_view_data_; 94 ppapi::ViewData renderer_view_data_;
95 scoped_ptr<PepperGraphics2DHost> host_; 95 std::unique_ptr<PepperGraphics2DHost> host_;
96 base::MessageLoop message_loop_; 96 base::MessageLoop message_loop_;
97 MockRendererPpapiHost renderer_ppapi_host_; 97 MockRendererPpapiHost renderer_ppapi_host_;
98 ppapi::TestGlobals test_globals_; 98 ppapi::TestGlobals test_globals_;
99 }; 99 };
100 100
101 TEST_F(PepperGraphics2DHostTest, ConvertToLogicalPixels) { 101 TEST_F(PepperGraphics2DHostTest, ConvertToLogicalPixels) {
102 static const struct { 102 static const struct {
103 int x1; 103 int x1;
104 int y1; 104 int y1;
105 int w1; 105 int w1;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 EXPECT_EQ(delta, gfx::Point(tests[i].dx2, tests[i].dy2)); 159 EXPECT_EQ(delta, gfx::Point(tests[i].dx2, tests[i].dy2));
160 } 160 }
161 // Reverse the scale and ensure all the original pixels are still inside 161 // Reverse the scale and ensure all the original pixels are still inside
162 // the result. 162 // the result.
163 ConvertToLogicalPixels(1.0f / tests[i].scale, &r1, NULL); 163 ConvertToLogicalPixels(1.0f / tests[i].scale, &r1, NULL);
164 EXPECT_TRUE(r1.Contains(orig)); 164 EXPECT_TRUE(r1.Contains(orig));
165 } 165 }
166 } 166 }
167 167
168 } // namespace content 168 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_graphics_2d_host.cc ('k') | content/renderer/pepper/pepper_in_process_resource_creation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698