Changeset 199955 in webkit


Ignore:
Timestamp:
Apr 23, 2016 2:33:49 PM (8 years ago)
Author:
Chris Dumez
Message:

Tie the DiagnosticLoggingClient's lifetime to the Page
https://bugs.webkit.org/show_bug.cgi?id=156938
<rdar://problem/25851499>

Reviewed by Antti Koivisto.

Source/WebCore:

Tie the DiagnosticLoggingClient's lifetime to the Page rather than to the
MainFrame. The diagnostic logging client in WebKit2 requires the WebPage
to be alive in order to send IPC to the UIProcess. The WebPage owns the
Page and Page is not refCounted so the lifetime of the
DiagnosticLoggingClient should now be tied to the one of the WebPage as
well.

Previously, the DiagnosticLoggingClient would stay alive as long as the
MainFrame and could apparently in rare cases outlive the WebPage, thus
crashing when trying to send the IPC.

  • history/PageCache.cpp:

(WebCore::logPageCacheFailureDiagnosticMessage):
(WebCore::canCachePage):

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::loadResource):
(WebCore::logMediaLoadRequest):
(WebCore::HTMLMediaElement::updatePlayState):
(WebCore::HTMLMediaElement::mediaPlayerEngineFailedToLoad):

  • loader/EmptyClients.h:
  • loader/FrameLoader.cpp:

(WebCore::logNavigation):
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
(WebCore::FrameLoader::continueLoadAfterNavigationPolicy):

  • loader/ResourceLoader.cpp:

(WebCore::logResourceResponseSource):

  • loader/SubframeLoader.cpp:

(WebCore::logPluginRequest):

  • loader/SubresourceLoader.cpp:

(WebCore::SubresourceLoader::willSendRequestInternal):
(WebCore::SubresourceLoader::didReceiveResponse):
(WebCore::logResourceLoaded):

  • loader/cache/CachedResourceLoader.cpp:

(WebCore::logMemoryCacheResourceRequest):
(WebCore::logResourceRevalidationDecision):

  • page/DiagnosticLoggingClient.h:
  • page/MainFrame.cpp:

(WebCore::MainFrame::MainFrame): Deleted.
(WebCore::MainFrame::~MainFrame): Deleted.
(WebCore::MainFrame::diagnosticLoggingClient): Deleted.

  • page/MainFrame.h:
  • page/Page.cpp:

(WebCore::Page::Page):
(WebCore::Page::~Page):
(WebCore::Page::diagnosticLoggingClient):

  • page/Page.h:

Source/WebKit2:

  • WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:

(WebKit::WebDiagnosticLoggingClient::pageDestroyed):
(WebKit::WebDiagnosticLoggingClient::mainFrameDestroyed): Deleted.

  • WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::willStartUserTriggeredZooming):

Location:
trunk/Source
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r199942 r199955  
     12016-04-23  Chris Dumez  <cdumez@apple.com>
     2
     3        Tie the DiagnosticLoggingClient's lifetime to the Page
     4        https://bugs.webkit.org/show_bug.cgi?id=156938
     5        <rdar://problem/25851499>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Tie the DiagnosticLoggingClient's lifetime to the Page rather than to the
     10        MainFrame. The diagnostic logging client in WebKit2 requires the WebPage
     11        to be alive in order to send IPC to the UIProcess. The WebPage owns the
     12        Page and Page is not refCounted so the lifetime of the
     13        DiagnosticLoggingClient should now be tied to the one of the WebPage as
     14        well.
     15
     16        Previously, the DiagnosticLoggingClient would stay alive as long as the
     17        MainFrame and could apparently in rare cases outlive the WebPage, thus
     18        crashing when trying to send the IPC.
     19
     20        * history/PageCache.cpp:
     21        (WebCore::logPageCacheFailureDiagnosticMessage):
     22        (WebCore::canCachePage):
     23        * html/HTMLMediaElement.cpp:
     24        (WebCore::HTMLMediaElement::loadResource):
     25        (WebCore::logMediaLoadRequest):
     26        (WebCore::HTMLMediaElement::updatePlayState):
     27        (WebCore::HTMLMediaElement::mediaPlayerEngineFailedToLoad):
     28        * loader/EmptyClients.h:
     29        * loader/FrameLoader.cpp:
     30        (WebCore::logNavigation):
     31        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
     32        (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
     33        * loader/ResourceLoader.cpp:
     34        (WebCore::logResourceResponseSource):
     35        * loader/SubframeLoader.cpp:
     36        (WebCore::logPluginRequest):
     37        * loader/SubresourceLoader.cpp:
     38        (WebCore::SubresourceLoader::willSendRequestInternal):
     39        (WebCore::SubresourceLoader::didReceiveResponse):
     40        (WebCore::logResourceLoaded):
     41        * loader/cache/CachedResourceLoader.cpp:
     42        (WebCore::logMemoryCacheResourceRequest):
     43        (WebCore::logResourceRevalidationDecision):
     44        * page/DiagnosticLoggingClient.h:
     45        * page/MainFrame.cpp:
     46        (WebCore::MainFrame::MainFrame): Deleted.
     47        (WebCore::MainFrame::~MainFrame): Deleted.
     48        (WebCore::MainFrame::diagnosticLoggingClient): Deleted.
     49        * page/MainFrame.h:
     50        * page/Page.cpp:
     51        (WebCore::Page::Page):
     52        (WebCore::Page::~Page):
     53        (WebCore::Page::diagnosticLoggingClient):
     54        * page/Page.h:
     55
    1562016-04-22  Chris Dumez  <cdumez@apple.com>
    257
  • trunk/Source/WebCore/history/PageCache.cpp

    r199003 r199955  
    7575        return;
    7676
    77     logPageCacheFailureDiagnosticMessage(page->mainFrame().diagnosticLoggingClient(), reason);
     77    logPageCacheFailureDiagnosticMessage(page->diagnosticLoggingClient(), reason);
    7878}
    7979
     
    191191    unsigned indentLevel = 0;
    192192    PCLOG("--------\n Determining if page can be cached:");
    193    
    194     MainFrame& mainFrame = page.mainFrame();
    195     DiagnosticLoggingClient& diagnosticLoggingClient = mainFrame.diagnosticLoggingClient();
    196     bool isCacheable = canCacheFrame(mainFrame, diagnosticLoggingClient, indentLevel + 1);
     193
     194    DiagnosticLoggingClient& diagnosticLoggingClient = page.diagnosticLoggingClient();
     195    bool isCacheable = canCacheFrame(page.mainFrame(), diagnosticLoggingClient, indentLevel + 1);
    197196   
    198197    if (!page.settings().usesPageCache() || page.isResourceCachingDisabled()) {
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r199733 r199955  
    13181318
    13191319    // Log that we started loading a media element.
    1320     if (Frame* frame = document().frame())
    1321         frame->mainFrame().diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::mediaKey(), isVideo() ? DiagnosticLoggingKeys::videoKey() : DiagnosticLoggingKeys::audioKey(), DiagnosticLoggingKeys::loadingKey(), ShouldSample::No);
     1320    page->diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::mediaKey(), isVideo() ? DiagnosticLoggingKeys::videoKey() : DiagnosticLoggingKeys::audioKey(), DiagnosticLoggingKeys::loadingKey(), ShouldSample::No);
    13221321
    13231322    m_firstTimePlaying = true;
     
    19881987        return;
    19891988
    1990     DiagnosticLoggingClient& diagnosticLoggingClient = page->mainFrame().diagnosticLoggingClient();
     1989    DiagnosticLoggingClient& diagnosticLoggingClient = page->diagnosticLoggingClient();
    19911990    if (!succeeded) {
    19921991        diagnosticLoggingClient.logDiagnosticMessageWithResult(DiagnosticLoggingKeys::mediaLoadingFailedKey(), errorMessage, DiagnosticLoggingResultFail, ShouldSample::No);
     
    48464845            if (m_firstTimePlaying) {
    48474846                // Log that a media element was played.
    4848                 if (Frame* frame = document().frame())
    4849                     frame->mainFrame().diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::mediaKey(), isVideo() ? DiagnosticLoggingKeys::videoKey() : DiagnosticLoggingKeys::audioKey(), DiagnosticLoggingKeys::playedKey(), ShouldSample::No);
     4847                if (auto* page = document().page())
     4848                    page->diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::mediaKey(), isVideo() ? DiagnosticLoggingKeys::videoKey() : DiagnosticLoggingKeys::audioKey(), DiagnosticLoggingKeys::playedKey(), ShouldSample::No);
    48504849                m_firstTimePlaying = false;
    48514850            }
     
    62976296        return;
    62986297
    6299     if (Frame* frame = document().frame())
    6300         frame->mainFrame().diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::engineFailedToLoadKey(), m_player->engineDescription(), String::number(m_player->platformErrorCode()), ShouldSample::No);
     6298    if (auto* page = document().page())
     6299        page->diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::engineFailedToLoadKey(), m_player->engineDescription(), String::number(m_player->platformErrorCode()), ShouldSample::No);
    63016300}
    63026301
  • trunk/Source/WebCore/loader/EmptyClients.cpp

    r199851 r199955  
    142142    pageConfiguration.progressTrackerClient = &dummyProgressTrackerClient.get();
    143143
    144     static NeverDestroyed<EmptyDiagnosticLoggingClient> dummyDiagnosticLoggingClient;
    145     pageConfiguration.diagnosticLoggingClient = &dummyDiagnosticLoggingClient.get();
     144    pageConfiguration.diagnosticLoggingClient = std::make_unique<EmptyDiagnosticLoggingClient>();
    146145
    147146    pageConfiguration.applicationCacheStorage = ApplicationCacheStorage::create(String(), String());
  • trunk/Source/WebCore/loader/EmptyClients.h

    r199673 r199955  
    641641    void logDiagnosticMessageWithResult(const String&, const String&, DiagnosticLoggingResultType, ShouldSample) override { }
    642642    void logDiagnosticMessageWithValue(const String&, const String&, const String&, ShouldSample) override { }
    643 
    644     void mainFrameDestroyed() override { }
    645643};
    646644
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r199735 r199955  
    13661366static void logNavigation(MainFrame& frame, FrameLoadType type)
    13671367{
     1368    if (!frame.page())
     1369        return;
     1370
    13681371    String navigationDescription;
    13691372    switch (type) {
     
    13941397        return;
    13951398    }
    1396     frame.diagnosticLoggingClient().logDiagnosticMessage(DiagnosticLoggingKeys::navigationKey(), navigationDescription, ShouldSample::No);
     1399    frame.page()->diagnosticLoggingClient().logDiagnosticMessage(DiagnosticLoggingKeys::navigationKey(), navigationDescription, ShouldSample::No);
    13971400}
    13981401
     
    23262329            if (m_frame.isMainFrame() && m_frame.page()) {
    23272330                ASSERT(&m_frame.page()->mainFrame() == &m_frame);
    2328                 m_frame.page()->mainFrame().diagnosticLoggingClient().logDiagnosticMessageWithResult(DiagnosticLoggingKeys::pageLoadedKey(), emptyString(), error.isNull() ? DiagnosticLoggingResultPass : DiagnosticLoggingResultFail, ShouldSample::Yes);
     2331                m_frame.page()->diagnosticLoggingClient().logDiagnosticMessageWithResult(DiagnosticLoggingKeys::pageLoadedKey(), emptyString(), error.isNull() ? DiagnosticLoggingResultPass : DiagnosticLoggingResultFail, ShouldSample::Yes);
    23292332            }
    23302333
     
    30503053
    30513054    if (isBackForwardLoadType(type)) {
    3052         auto& diagnosticLoggingClient = m_frame.mainFrame().diagnosticLoggingClient();
     3055        auto& diagnosticLoggingClient = m_frame.page()->diagnosticLoggingClient();
    30533056        if (history().provisionalItem()->isInPageCache()) {
    30543057            diagnosticLoggingClient.logDiagnosticMessageWithResult(DiagnosticLoggingKeys::pageCacheKey(), DiagnosticLoggingKeys::retrievalKey(), DiagnosticLoggingResultPass, ShouldSample::Yes);
  • trunk/Source/WebCore/loader/ResourceLoader.cpp

    r198180 r199955  
    404404static void logResourceResponseSource(Frame* frame, ResourceResponse::Source source)
    405405{
    406     if (!frame)
     406    if (!frame || !frame->page())
    407407        return;
    408408
     
    424424    }
    425425
    426     frame->mainFrame().diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceResponseKey(), DiagnosticLoggingKeys::sourceKey(), sourceKey, ShouldSample::Yes);
     426    frame->page()->diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceResponseKey(), DiagnosticLoggingKeys::sourceKey(), sourceKey, ShouldSample::Yes);
    427427}
    428428
  • trunk/Source/WebCore/loader/SubframeLoader.cpp

    r199313 r199955  
    210210    String description = !pluginFile ? newMIMEType : pluginFile;
    211211
    212     DiagnosticLoggingClient& diagnosticLoggingClient = page->mainFrame().diagnosticLoggingClient();
     212    DiagnosticLoggingClient& diagnosticLoggingClient = page->diagnosticLoggingClient();
    213213    diagnosticLoggingClient.logDiagnosticMessage(success ? DiagnosticLoggingKeys::pluginLoadedKey() : DiagnosticLoggingKeys::pluginLoadingFailedKey(), description, ShouldSample::No);
    214214
  • trunk/Source/WebCore/loader/SubresourceLoader.cpp

    r199650 r199955  
    183183            newRequest.makeUnconditional();
    184184            MemoryCache::singleton().revalidationFailed(*m_resource);
    185             if (m_frame)
    186                 m_frame->mainFrame().diagnosticLoggingClient().logDiagnosticMessageWithResult(DiagnosticLoggingKeys::cachedResourceRevalidationKey(), emptyString(), DiagnosticLoggingResultFail, ShouldSample::Yes);
     185            if (m_frame && m_frame->page())
     186                m_frame->page()->diagnosticLoggingClient().logDiagnosticMessageWithResult(DiagnosticLoggingKeys::cachedResourceRevalidationKey(), emptyString(), DiagnosticLoggingResultFail, ShouldSample::Yes);
    187187        }
    188188
     
    247247            m_resource->setResponse(response);
    248248            MemoryCache::singleton().revalidationSucceeded(*m_resource, response);
    249             if (m_frame)
    250                 m_frame->mainFrame().diagnosticLoggingClient().logDiagnosticMessageWithResult(DiagnosticLoggingKeys::cachedResourceRevalidationKey(), emptyString(), DiagnosticLoggingResultPass, ShouldSample::Yes);
     249            if (m_frame && m_frame->page())
     250                m_frame->page()->diagnosticLoggingClient().logDiagnosticMessageWithResult(DiagnosticLoggingKeys::cachedResourceRevalidationKey(), emptyString(), DiagnosticLoggingResultPass, ShouldSample::Yes);
    251251            if (!reachedTerminalState())
    252252                ResourceLoader::didReceiveResponse(response);
     
    255255        // Did not get 304 response, continue as a regular resource load.
    256256        MemoryCache::singleton().revalidationFailed(*m_resource);
    257         if (m_frame)
    258             m_frame->mainFrame().diagnosticLoggingClient().logDiagnosticMessageWithResult(DiagnosticLoggingKeys::cachedResourceRevalidationKey(), emptyString(), DiagnosticLoggingResultFail, ShouldSample::Yes);
     257        if (m_frame && m_frame->page())
     258            m_frame->page()->diagnosticLoggingClient().logDiagnosticMessageWithResult(DiagnosticLoggingKeys::cachedResourceRevalidationKey(), emptyString(), DiagnosticLoggingResultFail, ShouldSample::Yes);
    259259    }
    260260
     
    339339static void logResourceLoaded(Frame* frame, CachedResource::Type type)
    340340{
    341     if (!frame)
     341    if (!frame || !frame->page())
    342342        return;
    343343
     
    383383        break;
    384384    }
    385     frame->mainFrame().diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceKey(), DiagnosticLoggingKeys::loadedKey(), resourceType, ShouldSample::Yes);
     385    frame->page()->diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceKey(), DiagnosticLoggingKeys::loadedKey(), resourceType, ShouldSample::Yes);
    386386}
    387387
  • trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp

    r199881 r199955  
    540540static inline void logMemoryCacheResourceRequest(Frame* frame, const String& description, const String& value = String())
    541541{
    542     if (!frame)
     542    if (!frame || !frame->page())
    543543        return;
    544544    if (value.isNull())
    545         frame->mainFrame().diagnosticLoggingClient().logDiagnosticMessage(DiagnosticLoggingKeys::resourceRequestKey(), description, ShouldSample::Yes);
     545        frame->page()->diagnosticLoggingClient().logDiagnosticMessage(DiagnosticLoggingKeys::resourceRequestKey(), description, ShouldSample::Yes);
    546546    else
    547         frame->mainFrame().diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceRequestKey(), description, value, ShouldSample::Yes);
     547        frame->page()->diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::resourceRequestKey(), description, value, ShouldSample::Yes);
    548548}
    549549
     
    720720static void logResourceRevalidationDecision(CachedResource::RevalidationDecision reason, const Frame* frame)
    721721{
    722     if (!frame)
    723         return;
    724     auto& logClient = frame->mainFrame().diagnosticLoggingClient();
     722    if (!frame || !frame->page())
     723        return;
     724    auto& logClient = frame->page()->diagnosticLoggingClient();
    725725    switch (reason) {
    726726    case CachedResource::RevalidationDecision::No:
  • trunk/Source/WebCore/page/DiagnosticLoggingClient.h

    r186707 r199955  
    2828
    2929#include "DiagnosticLoggingResultType.h"
     30#include <wtf/FastMalloc.h>
    3031#include <wtf/Forward.h>
    3132#include <wtf/RandomNumber.h>
     
    3637
    3738class DiagnosticLoggingClient {
     39    WTF_MAKE_FAST_ALLOCATED;
    3840public:
    3941    virtual void logDiagnosticMessage(const String& message, const String& description, ShouldSample) = 0;
     
    4143    virtual void logDiagnosticMessageWithValue(const String& message, const String& description, const String& value, ShouldSample) = 0;
    4244
    43     virtual void mainFrameDestroyed() = 0;
    44 
    4545    static bool shouldLogAfterSampling(ShouldSample);
    4646
    47 protected:
    4847    virtual ~DiagnosticLoggingClient() { }
    4948};
  • trunk/Source/WebCore/page/MainFrame.cpp

    r199181 r199955  
    5656    , m_recentWheelEventDeltaFilter(WheelEventDeltaFilter::create())
    5757    , m_pageOverlayController(std::make_unique<PageOverlayController>(*this))
    58     , m_diagnosticLoggingClient(configuration.diagnosticLoggingClient)
    5958{
    6059#if USE(APPLE_INTERNAL_SDK)
     
    6564MainFrame::~MainFrame()
    6665{
    67     if (m_diagnosticLoggingClient)
    68         m_diagnosticLoggingClient->mainFrameDestroyed();
    69 
    7066    m_recentWheelEventDeltaFilter = nullptr;
    7167    m_eventHandler = nullptr;
     
    9793
    9894    deref();
    99 }
    100 
    101 DiagnosticLoggingClient& MainFrame::diagnosticLoggingClient() const
    102 {
    103     static NeverDestroyed<EmptyDiagnosticLoggingClient> dummyClient;
    104     if (!settings().diagnosticLoggingEnabled() || !m_diagnosticLoggingClient)
    105         return dummyClient;
    106 
    107     return *m_diagnosticLoggingClient;
    10895}
    10996
  • trunk/Source/WebCore/page/MainFrame.h

    r198805 r199955  
    3737namespace WebCore {
    3838
    39 class DiagnosticLoggingClient;
    4039class PageConfiguration;
    4140class PageOverlayController;
     
    6867#endif // PLATFORM(MAC)
    6968
    70     WEBCORE_EXPORT DiagnosticLoggingClient& diagnosticLoggingClient() const;
    71 
    7269#if USE(APPLE_INTERNAL_SDK)
    7370#include <WebKitAdditions/MainFrameMembers.h>
     
    9087    std::unique_ptr<WheelEventDeltaFilter> m_recentWheelEventDeltaFilter;
    9188    std::unique_ptr<PageOverlayController> m_pageOverlayController;
    92     DiagnosticLoggingClient* m_diagnosticLoggingClient;
    9389};
    9490
  • trunk/Source/WebCore/page/Page.cpp

    r199849 r199955  
    3232#include "ContextMenuController.h"
    3333#include "DatabaseProvider.h"
     34#include "DiagnosticLoggingClient.h"
    3435#include "DocumentLoader.h"
    3536#include "DocumentMarkerController.h"
     
    3738#include "Editor.h"
    3839#include "EditorClient.h"
     40#include "EmptyClients.h"
    3941#include "Event.h"
    4042#include "EventNames.h"
     
    182184    , m_plugInClient(pageConfiguration.plugInClient)
    183185    , m_validationMessageClient(pageConfiguration.validationMessageClient)
     186    , m_diagnosticLoggingClient(WTFMove(pageConfiguration.diagnosticLoggingClient))
    184187    , m_subframeCount(0)
    185188    , m_openedByDOM(false)
     
    268271Page::~Page()
    269272{
     273    m_diagnosticLoggingClient = nullptr;
    270274    m_mainFrame->setView(nullptr);
    271275    setGroupName(String());
     
    761765}
    762766
     767DiagnosticLoggingClient& Page::diagnosticLoggingClient() const
     768{
     769    static NeverDestroyed<EmptyDiagnosticLoggingClient> dummyClient;
     770    if (!settings().diagnosticLoggingEnabled() || !m_diagnosticLoggingClient)
     771        return dummyClient;
     772
     773    return *m_diagnosticLoggingClient;
     774}
     775
    763776void Page::setMediaVolume(float volume)
    764777{
  • trunk/Source/WebCore/page/Page.h

    r199286 r199955  
    8585class ContextMenuController;
    8686class DatabaseProvider;
     87class DiagnosticLoggingClient;
    8788class DragCaretController;
    8889class DragClient;
     
    329330    WEBCORE_EXPORT unsigned pageCount() const;
    330331
     332    WEBCORE_EXPORT DiagnosticLoggingClient& diagnosticLoggingClient() const;
     333
    331334    // Notifications when the Page starts and stops being presented via a native window.
    332335    WEBCORE_EXPORT void setViewState(ViewState::Flags);
     
    585588    PlugInClient* m_plugInClient;
    586589    ValidationMessageClient* m_validationMessageClient;
     590    std::unique_ptr<DiagnosticLoggingClient> m_diagnosticLoggingClient;
    587591
    588592    int m_subframeCount;
  • trunk/Source/WebCore/page/PageConfiguration.cpp

    r182497 r199955  
    3030#include "BackForwardClient.h"
    3131#include "DatabaseProvider.h"
     32#include "DiagnosticLoggingClient.h"
    3233#include "StorageNamespaceProvider.h"
    3334#include "UserContentController.h"
  • trunk/Source/WebCore/page/PageConfiguration.h

    r198180 r199955  
    7676    ValidationMessageClient* validationMessageClient { nullptr };
    7777    FrameLoaderClient* loaderClientForMainFrame { nullptr };
    78     DiagnosticLoggingClient* diagnosticLoggingClient { nullptr };
     78    std::unique_ptr<DiagnosticLoggingClient> diagnosticLoggingClient { nullptr };
    7979
    8080#if USE(APPLE_INTERNAL_SDK)
  • trunk/Source/WebKit2/ChangeLog

    r199951 r199955  
     12016-04-23  Chris Dumez  <cdumez@apple.com>
     2
     3        Tie the DiagnosticLoggingClient's lifetime to the Page
     4        https://bugs.webkit.org/show_bug.cgi?id=156938
     5        <rdar://problem/25851499>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
     10        (WebKit::WebDiagnosticLoggingClient::pageDestroyed):
     11        (WebKit::WebDiagnosticLoggingClient::mainFrameDestroyed): Deleted.
     12        * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
     13        * WebProcess/WebPage/ios/WebPageIOS.mm:
     14        (WebKit::WebPage::willStartUserTriggeredZooming):
     15
    1162016-04-23  Dan Bernstein  <mitz@apple.com>
    217
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp

    r186707 r199955  
    7878}
    7979
    80 void WebDiagnosticLoggingClient::mainFrameDestroyed()
    81 {
    82     delete this;
    83 }
    84 
    8580} // namespace WebKit
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h

    r197563 r199955  
    4444    void logDiagnosticMessageWithValue(const String& message, const String& description, const String& value, WebCore::ShouldSample) override;
    4545
    46     void mainFrameDestroyed() override;
    47 
    4846    WebPage& m_page;
    4947};
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r199951 r199955  
    402402    pageConfiguration.loaderClientForMainFrame = new WebFrameLoaderClient;
    403403    pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(*this);
    404     pageConfiguration.diagnosticLoggingClient = new WebDiagnosticLoggingClient(*this);
     404    pageConfiguration.diagnosticLoggingClient = std::make_unique<WebDiagnosticLoggingClient>(*this);
    405405
    406406    pageConfiguration.applicationCacheStorage = &WebProcess::singleton().applicationCacheStorage();
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r199817 r199955  
    29912991void WebPage::willStartUserTriggeredZooming()
    29922992{
    2993     m_page->mainFrame().diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::webViewKey(), DiagnosticLoggingKeys::userKey(), DiagnosticLoggingKeys::zoomedKey(), ShouldSample::No);
     2993    m_page->diagnosticLoggingClient().logDiagnosticMessageWithValue(DiagnosticLoggingKeys::webViewKey(), DiagnosticLoggingKeys::userKey(), DiagnosticLoggingKeys::zoomedKey(), ShouldSample::No);
    29942994    m_userHasChangedPageScaleFactor = true;
    29952995}
Note: See TracChangeset for help on using the changeset viewer.