| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 | 598 |
| 599 static String pointerAsString(const void* ptr) { | 599 static String pointerAsString(const void* ptr) { |
| 600 TextStream ts; | 600 TextStream ts; |
| 601 ts << ptr; | 601 ts << ptr; |
| 602 return ts.release(); | 602 return ts.release(); |
| 603 } | 603 } |
| 604 | 604 |
| 605 std::unique_ptr<JSONObject> GraphicsLayer::layerTreeAsJSON( | 605 std::unique_ptr<JSONObject> GraphicsLayer::layerTreeAsJSON( |
| 606 LayerTreeFlags flags) const { | 606 LayerTreeFlags flags) const { |
| 607 RenderingContextMap renderingContextMap; | 607 RenderingContextMap renderingContextMap; |
| 608 if (flags & OutputChildrenAsLayerList) { | 608 if (flags & OutputAsLayerTree) |
| 609 std::unique_ptr<JSONObject> json = JSONObject::create(); | 609 return layerTreeAsJSONInternal(flags, renderingContextMap); |
| 610 std::unique_ptr<JSONArray> layersArray = JSONArray::create(); | 610 std::unique_ptr<JSONObject> json = JSONObject::create(); |
| 611 for (auto& child : m_children) | 611 std::unique_ptr<JSONArray> layersArray = JSONArray::create(); |
| 612 child->layersAsJSONArray(flags, renderingContextMap, layersArray.get()); | 612 for (auto& child : m_children) |
| 613 json->setArray("layers", std::move(layersArray)); | 613 child->layersAsJSONArray(flags, renderingContextMap, layersArray.get()); |
| 614 return json; | 614 json->setArray("layers", std::move(layersArray)); |
| 615 } | 615 return json; |
| 616 return layerTreeAsJSONInternal(flags, renderingContextMap); | |
| 617 } | 616 } |
| 618 | 617 |
| 619 std::unique_ptr<JSONObject> GraphicsLayer::layerAsJSONInternal( | 618 std::unique_ptr<JSONObject> GraphicsLayer::layerAsJSONInternal( |
| 620 LayerTreeFlags flags, | 619 LayerTreeFlags flags, |
| 621 RenderingContextMap& renderingContextMap) const { | 620 RenderingContextMap& renderingContextMap) const { |
| 622 std::unique_ptr<JSONObject> json = JSONObject::create(); | 621 std::unique_ptr<JSONObject> json = JSONObject::create(); |
| 623 | 622 |
| 624 if (flags & LayerTreeIncludesDebugInfo) | 623 if (flags & LayerTreeIncludesDebugInfo) |
| 625 json->setString("this", pointerAsString(this)); | 624 json->setString("this", pointerAsString(this)); |
| 626 | 625 |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { | 1274 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { |
| 1276 if (!layer) { | 1275 if (!layer) { |
| 1277 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); | 1276 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); |
| 1278 return; | 1277 return; |
| 1279 } | 1278 } |
| 1280 | 1279 |
| 1281 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1280 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
| 1282 fprintf(stderr, "%s\n", output.utf8().data()); | 1281 fprintf(stderr, "%s\n", output.utf8().data()); |
| 1283 } | 1282 } |
| 1284 #endif | 1283 #endif |
| OLD | NEW |