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

Side by Side Diff: cc/ipc/copy_output_result_struct_traits.cc

Issue 2659703002: Implemented StructTraits for cc::CopyOutputResult (Closed)
Patch Set: c Created 3 years, 10 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "cc/ipc/copy_output_result_struct_traits.h"
6
7 namespace mojo {
8
9 // static
10 bool StructTraits<cc::mojom::CopyOutputResultDataView, cc::CopyOutputResult>::
11 Read(cc::mojom::CopyOutputResultDataView data, cc::CopyOutputResult* out) {
12 out->bitmap_ = base::MakeUnique<SkBitmap>();
13 return data.ReadSize(&out->size_) && data.ReadBitmap(out->bitmap_.get()) &&
14 data.ReadTextureMailbox(&out->texture_mailbox_);
15 }
16
17 // static
18 const SkBitmap&
19 StructTraits<cc::mojom::CopyOutputResultDataView, cc::CopyOutputResult>::bitmap(
20 const cc::CopyOutputResult& result) {
21 static SkBitmap* null_bitmap = nullptr;
Ken Rockot(use gerrit already) 2017/02/01 16:04:55 no need for this and conditional initialization. y
Saman Sami 2017/02/01 17:19:41 Done.
22 if (!result.bitmap_) {
23 if (!null_bitmap)
24 null_bitmap = new SkBitmap();
25 return *null_bitmap;
26 }
27 return *result.bitmap_;
28 }
29
30 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698