forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement CompositorFrame StructTraits
This CL implements CompositorFrame StructTraits. This CL deletes surfaces type converters, and updates call sites. In a subsequent CL, I'll add a perf test comparable to ParamTraits. CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel TBR=ben@chromium.org for content/renderer/mus BUG=611802 Review-Url: https://codereview.chromium.org/2092843002 Cr-Commit-Position: refs/heads/master@{#402199}
- Loading branch information
fsamuel
authored and
Commit bot
committed
Jun 27, 2016
1 parent
b16eada
commit ce098fb
Showing
38 changed files
with
323 additions
and
294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,6 @@ include_rules = [ | |
"+mojo/public", | ||
"+skia/public", | ||
"+ui/events/ipc", | ||
"+ui/events/mojo", | ||
"+ui/gfx/geometry/mojo", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright 2016 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
mojom = "//cc/ipc/compositor_frame.mojom" | ||
public_headers = [ "//cc/output/compositor_frame.h" ] | ||
traits_headers = [ "//cc/ipc/compositor_frame_struct_traits.h" ] | ||
sources = [ | ||
"//cc/ipc/compositor_frame_struct_traits.cc", | ||
] | ||
public_deps = [ | ||
"//cc", | ||
] | ||
type_mappings = | ||
[ "cc.mojom.CompositorFrame=cc::CompositorFrame[pass_by_value]" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2016 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "cc/ipc/compositor_frame_metadata_struct_traits.h" | ||
#include "cc/ipc/selection_struct_traits.h" | ||
#include "cc/ipc/surface_id_struct_traits.h" | ||
#include "ui/events/mojo/latency_info_struct_traits.h" | ||
#include "ui/gfx/mojo/selection_bound_struct_traits.h" | ||
|
||
namespace mojo { | ||
|
||
// static | ||
bool StructTraits<cc::mojom::CompositorFrameMetadata, | ||
cc::CompositorFrameMetadata>:: | ||
Read(cc::mojom::CompositorFrameMetadataDataView data, | ||
cc::CompositorFrameMetadata* out) { | ||
out->device_scale_factor = data.device_scale_factor(); | ||
if (!data.ReadRootScrollOffset(&out->root_scroll_offset)) | ||
return false; | ||
|
||
out->page_scale_factor = data.page_scale_factor(); | ||
if (!data.ReadScrollableViewportSize(&out->scrollable_viewport_size) || | ||
!data.ReadRootLayerSize(&out->root_layer_size)) { | ||
return false; | ||
} | ||
|
||
out->min_page_scale_factor = data.min_page_scale_factor(); | ||
out->max_page_scale_factor = data.max_page_scale_factor(); | ||
out->root_overflow_x_hidden = data.root_overflow_x_hidden(); | ||
out->root_overflow_y_hidden = data.root_overflow_y_hidden(); | ||
if (!data.ReadLocationBarOffset(&out->location_bar_offset) || | ||
!data.ReadLocationBarContentTranslation( | ||
&out->location_bar_content_translation)) { | ||
return false; | ||
} | ||
|
||
out->root_background_color = data.root_background_color(); | ||
return data.ReadSelection(&out->selection) && | ||
data.ReadLatencyInfo(&out->latency_info) && | ||
data.ReadSatisfiesSequences(&out->satisfies_sequences) && | ||
data.ReadReferencedSurfaces(&out->referenced_surfaces); | ||
} | ||
|
||
} // namespace mojo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2016 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "cc/ipc/compositor_frame_struct_traits.h" | ||
#include "cc/ipc/compositor_frame_metadata_struct_traits.h" | ||
#include "cc/ipc/render_pass_struct_traits.h" | ||
#include "cc/ipc/transferable_resource_struct_traits.h" | ||
|
||
namespace mojo { | ||
|
||
// static | ||
bool StructTraits<cc::mojom::CompositorFrame, cc::CompositorFrame>::Read( | ||
cc::mojom::CompositorFrameDataView data, | ||
cc::CompositorFrame* out) { | ||
if (!data.ReadMetadata(&out->metadata)) | ||
return false; | ||
|
||
out->delegated_frame_data.reset(new cc::DelegatedFrameData()); | ||
return data.ReadResources(&out->delegated_frame_data->resource_list) && | ||
data.ReadPasses(&out->delegated_frame_data->render_pass_list); | ||
} | ||
|
||
} // namespace mojo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2016 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CC_IPC_COMPOSITOR_FRAME_STRUCT_TRAITS_H_ | ||
#define CC_IPC_COMPOSITOR_FRAME_STRUCT_TRAITS_H_ | ||
|
||
#include "cc/ipc/compositor_frame.mojom.h" | ||
#include "cc/output/compositor_frame.h" | ||
|
||
namespace mojo { | ||
|
||
template <> | ||
struct StructTraits<cc::mojom::CompositorFrame, cc::CompositorFrame> { | ||
static const cc::CompositorFrameMetadata& metadata( | ||
const cc::CompositorFrame& input) { | ||
return input.metadata; | ||
} | ||
|
||
static const cc::TransferableResourceArray& resources( | ||
const cc::CompositorFrame& input) { | ||
return input.delegated_frame_data->resource_list; | ||
} | ||
|
||
static const cc::RenderPassList& passes(const cc::CompositorFrame& input) { | ||
return input.delegated_frame_data->render_pass_list; | ||
} | ||
|
||
static bool Read(cc::mojom::CompositorFrameDataView data, | ||
cc::CompositorFrame* out); | ||
}; | ||
|
||
} // namespace mojo | ||
|
||
#endif // CC_IPC_COMPOSITOR_FRAME_STRUCT_TRAITS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2016 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "cc/ipc/transferable_resource_struct_traits.h" | ||
#include "gpu/ipc/common/mailbox_holder_struct_traits.h" | ||
#include "gpu/ipc/common/mailbox_struct_traits.h" | ||
#include "gpu/ipc/common/sync_token_struct_traits.h" | ||
#include "ui/gfx/geometry/mojo/geometry_struct_traits.h" | ||
|
||
namespace mojo { | ||
|
||
// static | ||
bool StructTraits<cc::mojom::TransferableResource, cc::TransferableResource>:: | ||
Read(cc::mojom::TransferableResourceDataView data, | ||
cc::TransferableResource* out) { | ||
if (!data.ReadSize(&out->size) || | ||
!data.ReadMailboxHolder(&out->mailbox_holder)) | ||
return false; | ||
out->id = data.id(); | ||
out->format = static_cast<cc::ResourceFormat>(data.format()); | ||
out->filter = data.filter(); | ||
out->read_lock_fences_enabled = data.read_lock_fences_enabled(); | ||
out->is_software = data.is_software(); | ||
out->is_overlay_candidate = data.is_overlay_candidate(); | ||
return true; | ||
} | ||
|
||
} // namespace mojo |
Oops, something went wrong.