Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 37f282e65d2edf8c3c72614ad822ac26cfa8a062
      
https://github.com/WebKit/WebKit/commit/37f282e65d2edf8c3c72614ad822ac26cfa8a062
  Author: Darin Adler <da...@apple.com>
  Date:   2023-01-30 (Mon, 30 Jan 2023)

  Changed paths:
    M Source/WebCore/inspector/InspectorCanvas.cpp
    M Source/WebCore/inspector/InspectorCanvas.h
    M Source/WebCore/inspector/InspectorShaderProgram.cpp
    M Source/WebCore/inspector/InspectorShaderProgram.h
    M Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp
    M Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
    M Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
    M Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h

  Log Message:
  -----------
  Unnecessarily using std::variant and std::monostate when we could just use 
nullptr instead
https://bugs.webkit.org/show_bug.cgi?id=251346
rdar://problem/104809022

Reviewed by Patrick Angle.

Using std::variant, std::reference_wrapper, and std::monostate is like a 
pointer, but less
efficient. Using std::optional and std::reference_wrapper is the same. Found 
places in our
code where we did that and removed them. Also updated one place that used 
std::reference_wrapper
where a reference would work just as well.

* Source/WebCore/inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::canvasContext const): Moved to the header since it's 
now trivial.
(WebCore::InspectorCanvas::canvasElement const): Removed the switchOn since 
m_context is now
a reference rather than a variant.
(WebCore::InspectorCanvas::scriptExecutionContext const): Ditto.
(WebCore::InspectorCanvas::resolveContext const): Ditto.
(WebCore::InspectorCanvas::clientNodes const): Ditto.
(WebCore::InspectorCanvas::canvasChanged): Ditto.
(WebCore::InspectorCanvas::resetRecordingData): Ditto.
(WebCore::InspectorCanvas::recordAction): Ditto.
(WebCore::InspectorCanvas::buildObjectForCanvas): Ditto.
(WebCore::InspectorCanvas::releaseObjectForRecording): Ditto.
(WebCore::InspectorCanvas::buildInitialState): Ditto.

* Source/WebCore/inspector/InspectorCanvas.h: Removed some unneded includes. Use
CanvasRenderingContext& for m_context.

* Source/WebCore/inspector/InspectorShaderProgram.cpp: Removed redundant checks 
of
(WebCore::InspectorShaderProgram::program const): Moved to the header since 
it's now
trivial.
(WebCore::InspectorShaderProgram::requestShaderSource): Removed the switchOn 
since m_program
is now a reference rather than a variant. Also changed to use early return, 
WebKit style.
(WebCore::InspectorShaderProgram::updateShader): Ditto.
(WebCore::InspectorShaderProgram::buildObjectForShaderProgram): Removed the 
code that looked
at m_program entirely, since it did't do anything.

* Source/WebCore/inspector/InspectorShaderProgram.h: Removed redundant checks of
m_program.

* Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::startRecording): Updated since 
InspectorCanvas::canvasContext
now returns a reference.
(WebCore::InspectorCanvasAgent::stopRecording): Ditto.
(WebCore::InspectorCanvasAgent::recordAction): Ditto.
(WebCore::InspectorCanvasAgent::reset): Ditto.
(WebCore::InspectorCanvasAgent::unbindCanvas): Ditto.
(WebCore::InspectorCanvasAgent::findInspectorCanvas): Ditto.
(WebCore::InspectorCanvasAgent::findInspectorProgram): Updated since
InspectorShaderProgram::program now returns a reference.

* Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::managedDomainsIfInitialized): Return a pointer.
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::forwardManagedDomainsToITPIfInitialized): Updated 
since
managedDomainsIfInitialized now returns a pointer.
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h: Updated.

Canonical link: https://commits.webkit.org/259572@main


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to