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

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, 8 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 SVGImage::SVGImage(ImageObserver* observer) 64 SVGImage::SVGImage(ImageObserver* observer)
65 : Image(observer) 65 : Image(observer)
66 { 66 {
67 } 67 }
68 68
69 SVGImage::~SVGImage() 69 SVGImage::~SVGImage()
70 { 70 {
71 if (m_page) { 71 if (m_page) {
72 // Store m_page in a local variable, clearing m_page, so that SVGImageCh romeClient knows we're destructed. 72 // Store m_page in a local variable, clearing m_page, so that SVGImageCh romeClient knows we're destructed.
73 OwnPtrWillBeRawPtr<Page> currentPage = m_page.release(); 73 RawPtr<Page> currentPage = m_page.release();
74 // Break both the loader and view references to the frame 74 // Break both the loader and view references to the frame
75 currentPage->willBeDestroyed(); 75 currentPage->willBeDestroyed();
76 } 76 }
77 77
78 // Verify that page teardown destroyed the Chrome 78 // Verify that page teardown destroyed the Chrome
79 ASSERT(!m_chromeClient || !m_chromeClient->image()); 79 ASSERT(!m_chromeClient || !m_chromeClient->image());
80 } 80 }
81 81
82 LayoutRect SVGImage::visualRect() const 82 LayoutRect SVGImage::visualRect() const
83 { 83 {
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 if (!data()->size()) 462 if (!data()->size())
463 return true; 463 return true;
464 464
465 if (allDataReceived) { 465 if (allDataReceived) {
466 // SVGImage will fire events (and the default C++ handlers run) but does n't 466 // SVGImage will fire events (and the default C++ handlers run) but does n't
467 // actually allow script to run so it's fine to call into it. We allow t his 467 // actually allow script to run so it's fine to call into it. We allow t his
468 // since it means an SVG data url can synchronously load like other imag e 468 // since it means an SVG data url can synchronously load like other imag e
469 // types. 469 // types.
470 EventDispatchForbiddenScope::AllowUserAgentEvents allowUserAgentEvents; 470 EventDispatchForbiddenScope::AllowUserAgentEvents allowUserAgentEvents;
471 471
472 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<FrameLoaderClient>, dummyFram eLoaderClient, (EmptyFrameLoaderClient::create())); 472 DEFINE_STATIC_LOCAL(Persistent<FrameLoaderClient>, dummyFrameLoaderClien t, (EmptyFrameLoaderClient::create()));
473 473
474 if (m_page) { 474 if (m_page) {
475 toLocalFrame(m_page->mainFrame())->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data(), AtomicString("image/svg+xml", AtomicString:: ConstructFromLiteral), 475 toLocalFrame(m_page->mainFrame())->loader().load(FrameLoadRequest(0, blankURL(), SubstituteData(data(), AtomicString("image/svg+xml", AtomicString:: ConstructFromLiteral),
476 AtomicString("UTF-8", AtomicString::ConstructFromLiteral), KURL( ), ForceSynchronousLoad))); 476 AtomicString("UTF-8", AtomicString::ConstructFromLiteral), KURL( ), ForceSynchronousLoad)));
477 return true; 477 return true;
478 } 478 }
479 479
480 Page::PageClients pageClients; 480 Page::PageClients pageClients;
481 fillWithEmptyClients(pageClients); 481 fillWithEmptyClients(pageClients);
482 m_chromeClient = SVGImageChromeClient::create(this); 482 m_chromeClient = SVGImageChromeClient::create(this);
483 pageClients.chromeClient = m_chromeClient.get(); 483 pageClients.chromeClient = m_chromeClient.get();
484 484
485 // FIXME: If this SVG ends up loading itself, we might leak the world. 485 // FIXME: If this SVG ends up loading itself, we might leak the world.
486 // The Cache code does not know about ImageResources holding Frames and 486 // The Cache code does not know about ImageResources holding Frames and
487 // won't know to break the cycle. 487 // won't know to break the cycle.
488 // This will become an issue when SVGImage will be able to load other 488 // This will become an issue when SVGImage will be able to load other
489 // SVGImage objects, but we're safe now, because SVGImage can only be 489 // SVGImage objects, but we're safe now, because SVGImage can only be
490 // loaded by a top-level document. 490 // loaded by a top-level document.
491 OwnPtrWillBeRawPtr<Page> page; 491 RawPtr<Page> page;
492 { 492 {
493 TRACE_EVENT0("blink", "SVGImage::dataChanged::createPage"); 493 TRACE_EVENT0("blink", "SVGImage::dataChanged::createPage");
494 page = Page::create(pageClients); 494 page = Page::create(pageClients);
495 page->settings().setScriptEnabled(false); 495 page->settings().setScriptEnabled(false);
496 page->settings().setPluginsEnabled(false); 496 page->settings().setPluginsEnabled(false);
497 page->settings().setAcceleratedCompositingEnabled(false); 497 page->settings().setAcceleratedCompositingEnabled(false);
498 498
499 // Because this page is detached, it can't get default font settings 499 // Because this page is detached, it can't get default font settings
500 // from the embedder. Copy over font settings so we have sensible 500 // from the embedder. Copy over font settings so we have sensible
501 // defaults. These settings are fixed and will not update if changed . 501 // defaults. These settings are fixed and will not update if changed .
502 if (!Page::ordinaryPages().isEmpty()) { 502 if (!Page::ordinaryPages().isEmpty()) {
503 Settings& defaultSettings = (*Page::ordinaryPages().begin())->se ttings(); 503 Settings& defaultSettings = (*Page::ordinaryPages().begin())->se ttings();
504 page->settings().genericFontFamilySettings() = defaultSettings.g enericFontFamilySettings(); 504 page->settings().genericFontFamilySettings() = defaultSettings.g enericFontFamilySettings();
505 page->settings().setMinimumFontSize(defaultSettings.minimumFontS ize()); 505 page->settings().setMinimumFontSize(defaultSettings.minimumFontS ize());
506 page->settings().setMinimumLogicalFontSize(defaultSettings.minim umLogicalFontSize()); 506 page->settings().setMinimumLogicalFontSize(defaultSettings.minim umLogicalFontSize());
507 page->settings().setDefaultFontSize(defaultSettings.defaultFontS ize()); 507 page->settings().setDefaultFontSize(defaultSettings.defaultFontS ize());
508 page->settings().setDefaultFixedFontSize(defaultSettings.default FixedFontSize()); 508 page->settings().setDefaultFixedFontSize(defaultSettings.default FixedFontSize());
509 } 509 }
510 } 510 }
511 511
512 RefPtrWillBeRawPtr<LocalFrame> frame = nullptr; 512 RawPtr<LocalFrame> frame = nullptr;
513 { 513 {
514 TRACE_EVENT0("blink", "SVGImage::dataChanged::createFrame"); 514 TRACE_EVENT0("blink", "SVGImage::dataChanged::createFrame");
515 frame = LocalFrame::create(dummyFrameLoaderClient.get(), &page->fram eHost(), 0); 515 frame = LocalFrame::create(dummyFrameLoaderClient.get(), &page->fram eHost(), 0);
516 frame->setView(FrameView::create(frame.get())); 516 frame->setView(FrameView::create(frame.get()));
517 frame->init(); 517 frame->init();
518 } 518 }
519 519
520 FrameLoader& loader = frame->loader(); 520 FrameLoader& loader = frame->loader();
521 loader.forceSandboxFlags(SandboxAll); 521 loader.forceSandboxFlags(SandboxAll);
522 522
(...skipping 13 matching lines...) Expand all
536 536
537 return m_page; 537 return m_page;
538 } 538 }
539 539
540 String SVGImage::filenameExtension() const 540 String SVGImage::filenameExtension() const
541 { 541 {
542 return "svg"; 542 return "svg";
543 } 543 }
544 544
545 } // namespace blink 545 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698