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

Side by Side Diff: components/exo/surface.cc

Issue 1558513002: Global conversion of Pass()→std::move() on OS=linux (GYP edition) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: formatted Created 4 years, 11 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/exo/shared_memory.cc ('k') | components/exo/wayland/server.cc » ('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 2015 The Chromium Authors. All rights reserved. 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 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/exo/surface.h" 5 #include "components/exo/surface.h"
6 6
7 #include <utility>
8
7 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
8 #include "base/logging.h" 10 #include "base/logging.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/trace_event/trace_event.h" 12 #include "base/trace_event/trace_event.h"
11 #include "base/trace_event/trace_event_argument.h" 13 #include "base/trace_event/trace_event_argument.h"
12 #include "cc/resources/single_release_callback.h" 14 #include "cc/resources/single_release_callback.h"
13 #include "components/exo/buffer.h" 15 #include "components/exo/buffer.h"
14 #include "components/exo/surface_delegate.h" 16 #include "components/exo/surface_delegate.h"
15 #include "components/exo/surface_observer.h" 17 #include "components/exo/surface_observer.h"
16 #include "ui/aura/window_delegate.h" 18 #include "ui/aura/window_delegate.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 cc::TextureMailbox texture_mailbox; 264 cc::TextureMailbox texture_mailbox;
263 scoped_ptr<cc::SingleReleaseCallback> texture_mailbox_release_callback; 265 scoped_ptr<cc::SingleReleaseCallback> texture_mailbox_release_callback;
264 if (current_buffer_) { 266 if (current_buffer_) {
265 texture_mailbox_release_callback = 267 texture_mailbox_release_callback =
266 current_buffer_->ProduceTextureMailbox(&texture_mailbox); 268 current_buffer_->ProduceTextureMailbox(&texture_mailbox);
267 } 269 }
268 270
269 if (texture_mailbox_release_callback) { 271 if (texture_mailbox_release_callback) {
270 // Update layer with the new contents. 272 // Update layer with the new contents.
271 layer()->SetTextureMailbox(texture_mailbox, 273 layer()->SetTextureMailbox(texture_mailbox,
272 texture_mailbox_release_callback.Pass(), 274 std::move(texture_mailbox_release_callback),
273 texture_mailbox.size_in_pixels()); 275 texture_mailbox.size_in_pixels());
274 layer()->SetTextureFlipped(false); 276 layer()->SetTextureFlipped(false);
275 layer()->SetBounds(gfx::Rect(layer()->bounds().origin(), 277 layer()->SetBounds(gfx::Rect(layer()->bounds().origin(),
276 texture_mailbox.size_in_pixels())); 278 texture_mailbox.size_in_pixels()));
277 layer()->SetFillsBoundsOpaquely(pending_opaque_region_.contains( 279 layer()->SetFillsBoundsOpaquely(pending_opaque_region_.contains(
278 gfx::RectToSkIRect(gfx::Rect(texture_mailbox.size_in_pixels())))); 280 gfx::RectToSkIRect(gfx::Rect(texture_mailbox.size_in_pixels()))));
279 } else { 281 } else {
280 // Show solid color content if no buffer is attached or we failed 282 // Show solid color content if no buffer is attached or we failed
281 // to produce a texture mailbox for the currently attached buffer. 283 // to produce a texture mailbox for the currently attached buffer.
282 layer()->SetShowSolidColorContent(); 284 layer()->SetShowSolidColorContent();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 // Early out if no contents is currently assigned to the surface. 397 // Early out if no contents is currently assigned to the surface.
396 if (!current_buffer_) 398 if (!current_buffer_)
397 return; 399 return;
398 400
399 // Update contents by producing a new texture mailbox for the current buffer. 401 // Update contents by producing a new texture mailbox for the current buffer.
400 cc::TextureMailbox texture_mailbox; 402 cc::TextureMailbox texture_mailbox;
401 scoped_ptr<cc::SingleReleaseCallback> texture_mailbox_release_callback = 403 scoped_ptr<cc::SingleReleaseCallback> texture_mailbox_release_callback =
402 current_buffer_->ProduceTextureMailbox(&texture_mailbox); 404 current_buffer_->ProduceTextureMailbox(&texture_mailbox);
403 if (texture_mailbox_release_callback) { 405 if (texture_mailbox_release_callback) {
404 layer()->SetTextureMailbox(texture_mailbox, 406 layer()->SetTextureMailbox(texture_mailbox,
405 texture_mailbox_release_callback.Pass(), 407 std::move(texture_mailbox_release_callback),
406 texture_mailbox.size_in_pixels()); 408 texture_mailbox.size_in_pixels());
407 layer()->SetTextureFlipped(false); 409 layer()->SetTextureFlipped(false);
408 layer()->SchedulePaint(gfx::Rect(texture_mailbox.size_in_pixels())); 410 layer()->SchedulePaint(gfx::Rect(texture_mailbox.size_in_pixels()));
409 } 411 }
410 } 412 }
411 413
412 void Surface::OnCompositingAborted(ui::Compositor* compositor) { 414 void Surface::OnCompositingAborted(ui::Compositor* compositor) {
413 // The contents of this surface might be lost if compositing aborted because 415 // The contents of this surface might be lost if compositing aborted because
414 // of a lost graphics context. We recover from this by updating the contents 416 // of a lost graphics context. We recover from this by updating the contents
415 // of the surface next time the compositor successfully ends compositing. 417 // of the surface next time the compositor successfully ends compositing.
416 update_contents_after_successful_compositing_ = true; 418 update_contents_after_successful_compositing_ = true;
417 } 419 }
418 420
419 void Surface::OnCompositingShuttingDown(ui::Compositor* compositor) { 421 void Surface::OnCompositingShuttingDown(ui::Compositor* compositor) {
420 compositor->RemoveObserver(this); 422 compositor->RemoveObserver(this);
421 compositor_ = nullptr; 423 compositor_ = nullptr;
422 } 424 }
423 425
424 } // namespace exo 426 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/shared_memory.cc ('k') | components/exo/wayland/server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698