| 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 OffsetFromLayoutObject() + | 380 OffsetFromLayoutObject() + |
| 381 IntSize(contents_rect_.Location().X(), contents_rect_.Location().Y())); | 381 IntSize(contents_rect_.Location().X(), contents_rect_.Location().Y())); |
| 382 } | 382 } |
| 383 } | 383 } |
| 384 | 384 |
| 385 static HashSet<int>* g_registered_layer_set; | 385 static HashSet<int>* g_registered_layer_set; |
| 386 | 386 |
| 387 void GraphicsLayer::RegisterContentsLayer(WebLayer* layer) { | 387 void GraphicsLayer::RegisterContentsLayer(WebLayer* layer) { |
| 388 if (!g_registered_layer_set) | 388 if (!g_registered_layer_set) |
| 389 g_registered_layer_set = new HashSet<int>; | 389 g_registered_layer_set = new HashSet<int>; |
| 390 if (g_registered_layer_set->Contains(layer->Id())) | 390 CHECK(!g_registered_layer_set->Contains(layer->Id())); |
| 391 IMMEDIATE_CRASH(); | |
| 392 g_registered_layer_set->insert(layer->Id()); | 391 g_registered_layer_set->insert(layer->Id()); |
| 393 } | 392 } |
| 394 | 393 |
| 395 void GraphicsLayer::UnregisterContentsLayer(WebLayer* layer) { | 394 void GraphicsLayer::UnregisterContentsLayer(WebLayer* layer) { |
| 396 DCHECK(g_registered_layer_set); | 395 DCHECK(g_registered_layer_set); |
| 397 if (!g_registered_layer_set->Contains(layer->Id())) | 396 CHECK(g_registered_layer_set->Contains(layer->Id())); |
| 398 IMMEDIATE_CRASH(); | |
| 399 g_registered_layer_set->erase(layer->Id()); | 397 g_registered_layer_set->erase(layer->Id()); |
| 400 } | 398 } |
| 401 | 399 |
| 402 void GraphicsLayer::SetContentsTo(WebLayer* layer) { | 400 void GraphicsLayer::SetContentsTo(WebLayer* layer) { |
| 403 bool children_changed = false; | 401 bool children_changed = false; |
| 404 if (layer) { | 402 if (layer) { |
| 405 DCHECK(g_registered_layer_set); | 403 DCHECK(g_registered_layer_set); |
| 406 if (!g_registered_layer_set->Contains(layer->Id())) | 404 CHECK(g_registered_layer_set->Contains(layer->Id())); |
| 407 IMMEDIATE_CRASH(); | |
| 408 if (contents_layer_id_ != layer->Id()) { | 405 if (contents_layer_id_ != layer->Id()) { |
| 409 SetupContentsLayer(layer); | 406 SetupContentsLayer(layer); |
| 410 children_changed = true; | 407 children_changed = true; |
| 411 } | 408 } |
| 412 UpdateContentsRect(); | 409 UpdateContentsRect(); |
| 413 } else { | 410 } else { |
| 414 if (contents_layer_) { | 411 if (contents_layer_) { |
| 415 children_changed = true; | 412 children_changed = true; |
| 416 | 413 |
| 417 // The old contents layer will be removed via updateChildList. | 414 // The old contents layer will be removed via updateChildList. |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { | 1292 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { |
| 1296 if (!layer) { | 1293 if (!layer) { |
| 1297 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil)."; | 1294 LOG(INFO) << "Cannot showGraphicsLayerTree for (nil)."; |
| 1298 return; | 1295 return; |
| 1299 } | 1296 } |
| 1300 | 1297 |
| 1301 String output = layer->LayerTreeAsText(blink::kLayerTreeIncludesDebugInfo); | 1298 String output = layer->LayerTreeAsText(blink::kLayerTreeIncludesDebugInfo); |
| 1302 LOG(INFO) << output.Utf8().data(); | 1299 LOG(INFO) << output.Utf8().data(); |
| 1303 } | 1300 } |
| 1304 #endif | 1301 #endif |
| OLD | NEW |