| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 } | 360 } |
| 361 decodedTiles[i] = adoptRef(new PictureSnapshot::TilePictureStream()); | 361 decodedTiles[i] = adoptRef(new PictureSnapshot::TilePictureStream()); |
| 362 decodedTiles[i]->layerOffset.set(x, y); | 362 decodedTiles[i]->layerOffset.set(x, y); |
| 363 if (!base64Decode(picture, decodedTiles[i]->data)) { | 363 if (!base64Decode(picture, decodedTiles[i]->data)) { |
| 364 *errorString = "Invalid base64 encoding"; | 364 *errorString = "Invalid base64 encoding"; |
| 365 return; | 365 return; |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 RefPtr<PictureSnapshot> snapshot = PictureSnapshot::load(decodedTiles); | 368 RefPtr<PictureSnapshot> snapshot = PictureSnapshot::load(decodedTiles); |
| 369 if (!snapshot) { | 369 if (!snapshot) { |
| 370 *errorString = "Invalida snapshot format"; | 370 *errorString = "Invalid snapshot format"; |
| 371 return; | 371 return; |
| 372 } | 372 } |
| 373 if (snapshot->isEmpty()) { |
| 374 *errorString = "Empty snapshot"; |
| 375 return; |
| 376 } |
| 377 |
| 373 *snapshotId = String::number(++s_lastSnapshotId); | 378 *snapshotId = String::number(++s_lastSnapshotId); |
| 374 bool newEntry = m_snapshotById.add(*snapshotId, snapshot).isNewEntry; | 379 bool newEntry = m_snapshotById.add(*snapshotId, snapshot).isNewEntry; |
| 375 ASSERT_UNUSED(newEntry, newEntry); | 380 ASSERT_UNUSED(newEntry, newEntry); |
| 376 } | 381 } |
| 377 | 382 |
| 378 void InspectorLayerTreeAgent::releaseSnapshot(ErrorString* errorString, const St
ring& snapshotId) | 383 void InspectorLayerTreeAgent::releaseSnapshot(ErrorString* errorString, const St
ring& snapshotId) |
| 379 { | 384 { |
| 380 SnapshotById::iterator it = m_snapshotById.find(snapshotId); | 385 SnapshotById::iterator it = m_snapshotById.find(snapshotId); |
| 381 if (it == m_snapshotById.end()) { | 386 if (it == m_snapshotById.end()) { |
| 382 *errorString = "Snapshot not found"; | 387 *errorString = "Snapshot not found"; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 void InspectorLayerTreeAgent::didRemovePageOverlay(const GraphicsLayer* layer) | 464 void InspectorLayerTreeAgent::didRemovePageOverlay(const GraphicsLayer* layer) |
| 460 { | 465 { |
| 461 size_t index = m_pageOverlayLayerIds.find(layer->platformLayer()->id()); | 466 size_t index = m_pageOverlayLayerIds.find(layer->platformLayer()->id()); |
| 462 if (index == WTF::kNotFound) | 467 if (index == WTF::kNotFound) |
| 463 return; | 468 return; |
| 464 m_pageOverlayLayerIds.remove(index); | 469 m_pageOverlayLayerIds.remove(index); |
| 465 } | 470 } |
| 466 | 471 |
| 467 | 472 |
| 468 } // namespace blink | 473 } // namespace blink |
| OLD | NEW |