Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1166)

Side by Side Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 SVGImage::SVGImage(ImageObserver* observer) 63 SVGImage::SVGImage(ImageObserver* observer)
64 : Image(observer) 64 : Image(observer)
65 { 65 {
66 } 66 }
67 67
68 SVGImage::~SVGImage() 68 SVGImage::~SVGImage()
69 { 69 {
70 if (m_page) { 70 if (m_page) {
71 // Store m_page in a local variable, clearing m_page, so that SVGImageCh romeClient knows we're destructed. 71 // Store m_page in a local variable, clearing m_page, so that SVGImageCh romeClient knows we're destructed.
72 OwnPtrWillBeRawPtr<Page> currentPage = m_page.release(); 72 RawPtr<Page> currentPage = m_page.release();
73 // Break both the loader and view references to the frame 73 // Break both the loader and view references to the frame
74 currentPage->willBeDestroyed(); 74 currentPage->willBeDestroyed();
75 } 75 }
76 76
77 // Verify that page teardown destroyed the Chrome 77 // Verify that page teardown destroyed the Chrome
78 ASSERT(!m_chromeClient || !m_chromeClient->image()); 78 ASSERT(!m_chromeClient || !m_chromeClient->image());
79 } 79 }
80 80
81 LayoutRect SVGImage::visualRect() const 81 LayoutRect SVGImage::visualRect() const
82 { 82 {
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 if (!data()->size()) 427 if (!data()->size())
428 return true; 428 return true;
429 429
430 if (allDataReceived) { 430 if (allDataReceived) {
431 // SVGImage will fire events (and the default C++ handlers run) but does n't 431 // SVGImage will fire events (and the default C++ handlers run) but does n't
432 // actually allow script to run so it's fine to call into it. We allow t his 432 // actually allow script to run so it's fine to call into it. We allow t his
433 // since it means an SVG data url can synchronously load like other imag e 433 // since it means an SVG data url can synchronously load like other imag e
434 // types. 434 // types.
435 EventDispatchForbiddenScope::AllowUserAgentEvents allowUserAgentEvents; 435 EventDispatchForbiddenScope::AllowUserAgentEvents allowUserAgentEvents;
436 436
437 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<FrameLoaderClient>, dummyFram eLoaderClient, (EmptyFrameLoaderClient::create())); 437 DEFINE_STATIC_LOCAL(Persistent<FrameLoaderClient>, dummyFrameLoaderClien t, (EmptyFrameLoaderClient::create()));
438 438
439 if (m_page) { 439 if (m_page) {
440 toLocalFrame(m_page->mainFrame())->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data(), AtomicString("image/svg+xml", AtomicString:: ConstructFromLiteral), 440 toLocalFrame(m_page->mainFrame())->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data(), AtomicString("image/svg+xml", AtomicString:: ConstructFromLiteral),
441 AtomicString("UTF-8", AtomicString::ConstructFromLiteral), KURL( ), ForceSynchronousLoad))); 441 AtomicString("UTF-8", AtomicString::ConstructFromLiteral), KURL( ), ForceSynchronousLoad)));
442 return true; 442 return true;
443 } 443 }
444 444
445 Page::PageClients pageClients; 445 Page::PageClients pageClients;
446 fillWithEmptyClients(pageClients); 446 fillWithEmptyClients(pageClients);
447 m_chromeClient = SVGImageChromeClient::create(this); 447 m_chromeClient = SVGImageChromeClient::create(this);
448 pageClients.chromeClient = m_chromeClient.get(); 448 pageClients.chromeClient = m_chromeClient.get();
449 449
450 // FIXME: If this SVG ends up loading itself, we might leak the world. 450 // FIXME: If this SVG ends up loading itself, we might leak the world.
451 // The Cache code does not know about ImageResources holding Frames and 451 // The Cache code does not know about ImageResources holding Frames and
452 // won't know to break the cycle. 452 // won't know to break the cycle.
453 // This will become an issue when SVGImage will be able to load other 453 // This will become an issue when SVGImage will be able to load other
454 // SVGImage objects, but we're safe now, because SVGImage can only be 454 // SVGImage objects, but we're safe now, because SVGImage can only be
455 // loaded by a top-level document. 455 // loaded by a top-level document.
456 OwnPtrWillBeRawPtr<Page> page; 456 RawPtr<Page> page;
457 { 457 {
458 TRACE_EVENT0("blink", "SVGImage::dataChanged::createPage"); 458 TRACE_EVENT0("blink", "SVGImage::dataChanged::createPage");
459 page = Page::create(pageClients); 459 page = Page::create(pageClients);
460 page->settings().setScriptEnabled(false); 460 page->settings().setScriptEnabled(false);
461 page->settings().setPluginsEnabled(false); 461 page->settings().setPluginsEnabled(false);
462 page->settings().setAcceleratedCompositingEnabled(false); 462 page->settings().setAcceleratedCompositingEnabled(false);
463 463
464 // Because this page is detached, it can't get default font settings 464 // Because this page is detached, it can't get default font settings
465 // from the embedder. Copy over font settings so we have sensible 465 // from the embedder. Copy over font settings so we have sensible
466 // defaults. These settings are fixed and will not update if changed . 466 // defaults. These settings are fixed and will not update if changed .
467 if (!Page::ordinaryPages().isEmpty()) { 467 if (!Page::ordinaryPages().isEmpty()) {
468 Settings& defaultSettings = (*Page::ordinaryPages().begin())->se ttings(); 468 Settings& defaultSettings = (*Page::ordinaryPages().begin())->se ttings();
469 page->settings().genericFontFamilySettings() = defaultSettings.g enericFontFamilySettings(); 469 page->settings().genericFontFamilySettings() = defaultSettings.g enericFontFamilySettings();
470 page->settings().setMinimumFontSize(defaultSettings.minimumFontS ize()); 470 page->settings().setMinimumFontSize(defaultSettings.minimumFontS ize());
471 page->settings().setMinimumLogicalFontSize(defaultSettings.minim umLogicalFontSize()); 471 page->settings().setMinimumLogicalFontSize(defaultSettings.minim umLogicalFontSize());
472 page->settings().setDefaultFontSize(defaultSettings.defaultFontS ize()); 472 page->settings().setDefaultFontSize(defaultSettings.defaultFontS ize());
473 page->settings().setDefaultFixedFontSize(defaultSettings.default FixedFontSize()); 473 page->settings().setDefaultFixedFontSize(defaultSettings.default FixedFontSize());
474 } 474 }
475 } 475 }
476 476
477 RefPtrWillBeRawPtr<LocalFrame> frame = nullptr; 477 RawPtr<LocalFrame> frame = nullptr;
478 { 478 {
479 TRACE_EVENT0("blink", "SVGImage::dataChanged::createFrame"); 479 TRACE_EVENT0("blink", "SVGImage::dataChanged::createFrame");
480 frame = LocalFrame::create(dummyFrameLoaderClient.get(), &page->fram eHost(), 0); 480 frame = LocalFrame::create(dummyFrameLoaderClient.get(), &page->fram eHost(), 0);
481 frame->setView(FrameView::create(frame.get())); 481 frame->setView(FrameView::create(frame.get()));
482 frame->init(); 482 frame->init();
483 } 483 }
484 484
485 FrameLoader& loader = frame->loader(); 485 FrameLoader& loader = frame->loader();
486 loader.forceSandboxFlags(SandboxAll); 486 loader.forceSandboxFlags(SandboxAll);
487 487
(...skipping 13 matching lines...) Expand all
501 501
502 return m_page; 502 return m_page;
503 } 503 }
504 504
505 String SVGImage::filenameExtension() const 505 String SVGImage::filenameExtension() const
506 { 506 {
507 return "svg"; 507 return "svg";
508 } 508 }
509 509
510 } // namespace blink 510 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698