diff options
author | dtrainor <dtrainor@chromium.org> | 2015-10-28 09:02:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-28 16:03:33 +0000 |
commit | 2191e4d3cb6b574fd532547a8f93e02f9168a706 (patch) | |
tree | 557ba88e2f263f76111a1f717543e75e71914d09 /cc/playback/display_item_proto_factory.cc | |
parent | c754d858cdae6ae15a554ecbc003d67b41168605 (diff) | |
download | chromium_src-2191e4d3cb6b574fd532547a8f93e02f9168a706.zip chromium_src-2191e4d3cb6b574fd532547a8f93e02f9168a706.tar.gz chromium_src-2191e4d3cb6b574fd532547a8f93e02f9168a706.tar.bz2 |
Add protobuf serialization to DisplayItemList
Serialize the following classes:
- DisplayItemListSettings
- DisplayItemList
- DisplayItem and all subclasses
- Did not fully serialize FilterDisplayItem. Serializing
FilterOperations will require more work. Will do in a follow up CL.
Added unit tests for all DisplayItems serialized.
BUG=541321
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1407793002
Cr-Commit-Position: refs/heads/master@{#356563}
Diffstat (limited to 'cc/playback/display_item_proto_factory.cc')
-rw-r--r-- | cc/playback/display_item_proto_factory.cc | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/cc/playback/display_item_proto_factory.cc b/cc/playback/display_item_proto_factory.cc new file mode 100644 index 0000000..b71fc9a --- /dev/null +++ b/cc/playback/display_item_proto_factory.cc @@ -0,0 +1,55 @@ +// Copyright 2015 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/playback/display_item_proto_factory.h" + +#include "cc/playback/clip_display_item.h" +#include "cc/playback/clip_path_display_item.h" +#include "cc/playback/compositing_display_item.h" +#include "cc/playback/drawing_display_item.h" +#include "cc/playback/filter_display_item.h" +#include "cc/playback/float_clip_display_item.h" +#include "cc/playback/transform_display_item.h" +#include "cc/proto/display_item.pb.h" + +namespace cc { + +// static +DisplayItem* DisplayItemProtoFactory::AllocateAndConstruct( + scoped_refptr<DisplayItemList> list, + const proto::DisplayItem& proto) { + switch (proto.type()) { + case proto::DisplayItem::Type_Clip: + return list->CreateAndAppendItem<ClipDisplayItem>(); + case proto::DisplayItem::Type_EndClip: + return list->CreateAndAppendItem<EndClipDisplayItem>(); + case proto::DisplayItem::Type_ClipPath: + return list->CreateAndAppendItem<ClipPathDisplayItem>(); + case proto::DisplayItem::Type_EndClipPath: + return list->CreateAndAppendItem<EndClipPathDisplayItem>(); + case proto::DisplayItem::Type_Compositing: + return list->CreateAndAppendItem<CompositingDisplayItem>(); + case proto::DisplayItem::Type_EndCompositing: + return list->CreateAndAppendItem<EndCompositingDisplayItem>(); + case proto::DisplayItem::Type_Drawing: + return list->CreateAndAppendItem<DrawingDisplayItem>(); + case proto::DisplayItem::Type_Filter: + return list->CreateAndAppendItem<FilterDisplayItem>(); + case proto::DisplayItem::Type_EndFilter: + return list->CreateAndAppendItem<EndFilterDisplayItem>(); + case proto::DisplayItem::Type_FloatClip: + return list->CreateAndAppendItem<FloatClipDisplayItem>(); + case proto::DisplayItem::Type_EndFloatClip: + return list->CreateAndAppendItem<EndFloatClipDisplayItem>(); + case proto::DisplayItem::Type_Transform: + return list->CreateAndAppendItem<TransformDisplayItem>(); + case proto::DisplayItem::Type_EndTransform: + return list->CreateAndAppendItem<EndTransformDisplayItem>(); + } + + NOTREACHED(); + return nullptr; +} + +} // namespace cc |