Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed missing headers from Webcore for Webkit2 #8

Merged
merged 17 commits into from
May 6, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
d883420
Building webkit command fix
RAJAGOPALAN-GANGADHARAN Feb 9, 2019
42addb5
Merge remote-tracking branch 'upstream/webkit2' into HEAD
RAJAGOPALAN-GANGADHARAN Mar 3, 2019
6fdad02
Restored haikus NetworkContext to latest state
RAJAGOPALAN-GANGADHARAN Mar 3, 2019
09f7990
Created WebEvent factory and some fixes for old haiku APIs and few he…
RAJAGOPALAN-GANGADHARAN Mar 6, 2019
7e97e5b
Few more build fixes
RAJAGOPALAN-GANGADHARAN Mar 9, 2019
1b9e6ac
Fixed few linking errors
RAJAGOPALAN-GANGADHARAN Mar 9, 2019
31351ab
More linking errors fixed
RAJAGOPALAN-GANGADHARAN Mar 11, 2019
5e05c55
Update WebProcessMainHaiku.cpp
RAJAGOPALAN-GANGADHARAN Mar 13, 2019
2cd19e0
Roll back licence info
RAJAGOPALAN-GANGADHARAN Mar 13, 2019
81a496a
Fixed building webkit2
RAJAGOPALAN-GANGADHARAN Mar 13, 2019
0d98b04
Cleanup job
RAJAGOPALAN-GANGADHARAN Mar 13, 2019
4a7a146
Configuring minibrowser build and execute [early stage]
RAJAGOPALAN-GANGADHARAN Mar 17, 2019
c80ae31
Merge branch 'webkit2' of https://github.com/RAJAGOPALAN-GANGADHARAN/…
RAJAGOPALAN-GANGADHARAN Mar 17, 2019
c9f0fd0
Initial implementation to load blank url and now trying to load html …
RAJAGOPALAN-GANGADHARAN Apr 5, 2019
7182b92
Process launching done succesffuly but for now have ignored the case …
RAJAGOPALAN-GANGADHARAN Apr 29, 2019
1e1c1ad
Added message handler to main run loop and made changes to webview st…
RAJAGOPALAN-GANGADHARAN May 2, 2019
7fc2bc0
Fixed naming and namespace inconsistencies
RAJAGOPALAN-GANGADHARAN May 2, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Source/WTF/wtf/haiku/RunLoopHaiku.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class LoopHandler: public BHandler
void MessageReceived(BMessage* message)
{
if (message->what == 'loop')
m_loop->iterate();
m_loop->iterate();
else if (message->what == 'tmrf') {
RunLoop::TimerBase* timer
= (RunLoop::TimerBase*)message->GetPointer("timer");
Expand Down Expand Up @@ -100,7 +100,7 @@ void RunLoop::run()
looper->LockLooper();
looper->AddHandler(current().m_handler);
looper->UnlockLooper();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will get the spacing and weird debug messages out as now my only aim is to get it rendering 😄

if (newLooper)
looper->Loop();
}
Expand All @@ -115,7 +115,8 @@ void RunLoop::stop()

void RunLoop::wakeUp()
{
m_handler->Looper()->PostMessage('loop', m_handler);
RunLoop::current().performWork();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, this look completely wrong!
RunLoop::wakeUp is called from other threads to wake up the loop.
performWork should be run inside the main loop thread.

There is nothing to win in taking such shortcuts. You will only get things to crash in very strange ways.

Also, this probably breaks existing use of runloop in WebKitLegacy. It would be great if I could merge your changes in the main branch, but with changes like this, it's not going to work.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry just was curious what happens beyond this point 😢 but i knew it is going to break things i will find howto make it work.

//m_handler->Looper()->PostMessage('loop', m_handler);
}

RunLoop::TimerBase::TimerBase(RunLoop& runLoop)
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/PlatformHaiku.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ list(APPEND WebCore_SOURCES
platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
platform/graphics/texmap/TextureMapperImageBuffer.cpp

platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
#platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the problem with this file?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file does not do anything everything is wrapped under USE(COORDINATEDGRAPHICS) while we have disabled it so thought it would be a good clean up 😅😅


platform/image-decoders/haiku/ImageDecoderHaiku.cpp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#if USE(CG)
typedef struct CGAffineTransform CGAffineTransform;
#elif PLATFORM(HAIKU)
#include "PlatformExportMacros.h"
#include <AffineTransform.h>
#endif

Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/platform/network/ResourceErrorBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include <wtf/URL.h>
#include <wtf/text/WTFString.h>
#include "PlatformExportMacros.h"

namespace WebCore {

Expand Down
8 changes: 4 additions & 4 deletions Source/WebCore/platform/network/haiku/HaikuFormDataStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ WTF::Optional<size_t> BFormDataIO::readFromFile(const FormDataElement::EncodedFi
m_fileHandle = FileSystem::openFile(fileData.filename, FileSystem::FileOpenMode::Read);

if (!FileSystem::isHandleValid(m_fileHandle)) {
LOG(Network, "Haiku - Failed while trying to open %s for upload\n", fileData.filename.utf8().data());
//LOG(Network, "Haiku - Failed while trying to open %s for upload\n", fileData.filename.utf8().data());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Is it just a missing include to define the LOG macro?

m_fileHandle = FileSystem::invalidPlatformFileHandle;
return WTF::nullopt;
}
Expand All @@ -126,7 +126,7 @@ WTF::Optional<size_t> BFormDataIO::readFromFile(const FormDataElement::EncodedFi
// handle open and read from the current position.
auto readBytes = FileSystem::readFromFile(m_fileHandle, buffer, size);
if (readBytes < 0) {
LOG(Network, "Haiku - Failed while trying to read %s for upload\n", fileData.filename.utf8().data());
//LOG(Network, "Haiku - Failed while trying to read %s for upload\n", fileData.filename.utf8().data());
FileSystem::closeFile(m_fileHandle);
m_fileHandle = FileSystem::invalidPlatformFileHandle;
return WTF::nullopt;
Expand Down Expand Up @@ -202,15 +202,15 @@ WTF::Optional<size_t> BFormDataIO::readFromBlob(const FormDataElement::EncodedBl


if (!FileSystem::isHandleValid(m_fileHandle)) {
LOG(Network, "Haiku - Failed while trying to open %s for upload\n", fileData.filename.utf8().data());
//LOG(Network, "Haiku - Failed while trying to open %s for upload\n", fileData.filename.utf8().data());
m_fileHandle = FileSystem::invalidPlatformFileHandle;
readBytes = -1;
} else {
// Note: there is no management of a file offset, we just keep the file
// handle open and read from the current position.
readBytes = FileSystem::readFromFile(m_fileHandle, buffer, size);
if (readBytes < 0) {
LOG(Network, "Haiku - Failed while trying to read %s for upload\n", fileData.filename.utf8().data());
//LOG(Network, "Haiku - Failed while trying to read %s for upload\n", fileData.filename.utf8().data());
}
}

Expand Down
3 changes: 2 additions & 1 deletion Source/WebKit/PlatformHaiku.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ list(APPEND WebKit_SOURCES
PluginProcess/unix/PluginProcessUnix.cpp

Shared/WebCoreArgumentCoders.cpp
Shared/haiku/AuxiliaryProcessMainHaiku.cpp
#Shared/haiku/AuxiliaryProcessMainHaiku.cpp
Shared/unix/AuxiliaryProcessMain.cpp
Shared/haiku/ProcessExecutablePathHaiku.cpp
Shared/haiku/ShareableBitmapHaiku.cpp
Shared/haiku/WebCoreArgumentCodersHaiku.cpp
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/Shared/unix/AuxiliaryProcessMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ namespace WebKit {

bool AuxiliaryProcessMainBase::parseCommandLine(int argc, char** argv)
{
fprintf(stderr,"\naux:%s\n",argv[1]);
ASSERT(argc >= 3);
if (argc < 3)
return false;

m_parameters.processIdentifier = makeObjectIdentifier<WebCore::ProcessIdentifierType>(atoll(argv[1]));
m_parameters.connectionIdentifier = atoi(argv[2]);
return true;
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/Shared/unix/AuxiliaryProcessMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int AuxiliaryProcessMain(int argc, char** argv)
initializeAuxiliaryProcess<AuxiliaryProcessType>(auxiliaryMain.takeInitializationParameters());
RunLoop::run();
auxiliaryMain.platformFinalize();

return EXIT_SUCCESS;
}

Expand Down
33 changes: 33 additions & 0 deletions Source/WebKit/UIProcess/API/haiku/WebView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "WebProcessPool.h"
#include "WebPageGroup.h"
#include "DrawingAreaProxyImpl.h"
#include <WebCore/IntRect.h>

using namespace WebKit;
using namespace WebCore;
Expand Down Expand Up @@ -62,6 +63,38 @@ const API::PageConfiguration& pageConfig)
fPage->drawingArea()->setSize(IntSize(rect.right - rect.left,
rect.top - rect.bottom));
}
BRect p(0,0,10,20);
paint(WebCore::IntRect(p));
}

static void drawPageBackground(const WebPageProxy* page,const BRect& rect)
{
if(!page->drawsBackground())
return;


}


void BWebView::paint(const IntRect& dirtyRect)
{
if(dirtyRect.isEmpty())
{
fprintf(stderr,"its empty\n");
return;
}
fPage->endPrinting();
if(DrawingAreaProxyImpl* drawingArea = static_cast <DrawingAreaProxyImpl*>(fPage->drawingArea()))
{
fprintf(stderr,"its painting\n");
WebCore::Region unpainted;
BView* surface = new BView("drawing_surface",B_WILL_DRAW);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BWebView is a BView, and it's the one you should draw on. Here you are creating a new BView every time this is called, which is a huge memory leak, and you are not going to draw anything onto the BWebView itself.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops im still learning so please forgive me. I do understand that it is wrong now. Uh how can i miss it out I am supposed to use the existing view to draw but im just overlaying it over and over.

drawingArea->paint(surface,dirtyRect,unpainted);
}
else
{
drawPageBackground(fPage.get(),dirtyRect);
}
}


6 changes: 5 additions & 1 deletion Source/WebKit/UIProcess/API/haiku/WebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ using namespace WebKit;
namespace WebKit
{
class BWebView:public API::ObjectImpl<API::Object::Type::View>,
public BView{
public BView
{
public:
static RefPtr<BWebView> create(const char*name,BRect rect,
BWindow* parentWindow,const API::PageConfiguration& config)
Expand All @@ -48,6 +49,9 @@ namespace WebKit
BView* getView() const {return fViewPort;}
private:
BWebView(const char*,BRect,BWindow*,const API::PageConfiguration&);

void paint(const WebCore::IntRect&);

BView* fViewPort {nullptr};
RefPtr<WebPageProxy> fPage;
std::unique_ptr<PageClientImpl> fPageClient;
Expand Down
7 changes: 5 additions & 2 deletions Source/WebKit/UIProcess/DrawingAreaProxyImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ void DrawingAreaProxyImpl::paint(BackingStore::PlatformGraphicsContext context,
unpaintedRegion = rect;

if (isInAcceleratedCompositingMode())
return;
{fprintf(stderr,"\nExiting impl");
return;}

ASSERT(m_currentBackingStoreStateID <= m_nextBackingStoreStateID);
if (m_currentBackingStoreStateID < m_nextBackingStoreStateID) {
Expand All @@ -75,7 +76,9 @@ void DrawingAreaProxyImpl::paint(BackingStore::PlatformGraphicsContext context,

// If we haven't yet received our first bits from the WebProcess then don't paint anything.
if (!m_hasReceivedFirstUpdate)
return;
{
fprintf(stderr,"not recieved anything\n");return;
}

if (m_isWaitingForDidUpdateBackingStoreState) {
// Wait for a DidUpdateBackingStoreState message that contains the new bits before we paint
Expand Down
3 changes: 2 additions & 1 deletion Source/WebKit/UIProcess/Launcher/ProcessLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void ProcessLauncher::didFinishLaunchingProcess(ProcessID processIdentifier, IPC
m_processIdentifier = processIdentifier;
m_isLaunching = false;


if (!m_client) {
// FIXME: Make Identifier a move-only object and release port rights/connections in the destructor.
#if OS(DARWIN) && !PLATFORM(GTK)
Expand All @@ -57,7 +58,7 @@ void ProcessLauncher::didFinishLaunchingProcess(ProcessID processIdentifier, IPC
#endif
return;
}

m_client->didFinishLaunching(this, identifier);
}

Expand Down
71 changes: 71 additions & 0 deletions Source/WebKit/UIProcess/Launcher/haiku/ProcessLauncherHaiku.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,83 @@
#include "config.h"
#include "ProcessLauncher.h"

#define __STDC_FORMAT_MACROS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes to get uint64 into a string(as a format specifier) we need this

#include <unistd.h>
#include <string>
#include <inttypes.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/resource.h>

#include <Looper.h>


using namespace WebCore;

namespace WebKit {

static const char* processName(ProcessLauncher::ProcessType type)
{
switch(type)
{
case ProcessLauncher::ProcessType::Web:
//debug later will be taken system based absolute path
return "/WebKit/webkit/WebKitBuild/Release/bin/WebProcess";
case ProcessLauncher::ProcessType::Network:
return "/WebKit/webkit/WebKitBuild/Release/bin/NetworkProcess";
}
}

void ProcessLauncher::launchProcess()
{
const char* name=processName(m_launchOptions.processType);
char* procName;
switch(m_launchOptions.processType)
{
case ProcessLauncher::ProcessType::Web:
procName="WebProcess";
break;
case ProcessLauncher::ProcessType::Network:
procName="NetworkProcess";
break;
}
//process identifier
uint64_t prID = m_launchOptions.processIdentifier.toUInt64();
fprintf(stderr,"\nlaunch%d\n",prID);
char buff[21];
snprintf(buff,sizeof(buff),"%"PRIu64,prID);
//

//socket
int sockets[2];
if(socketpair(AF_UNIX, SOCK_STREAM, 0, sockets)==-1)
{
fprintf(stderr,":(%s\n",strerror(errno));
}
//1-> client 0-> server is taken convention

std::string sock = std::to_string(sockets[1]);
char* sockBuff = new char[sock.length()+1];
strcpy(sockBuff,sock.c_str());
//

pid_t pid=fork();
char* m_args[]={procName,buff,sockBuff,NULL};
if(pid==0)
{
execvp(name,m_args);
}
else
{
fprintf(stderr,"\nChild:%d\n",pid);
}
fprintf(stderr,"\ngoing to send\n");
RefPtr<ProcessLauncher> protectedLauncher(this);

RunLoop::main().dispatch([protectedLauncher,pid,sockets]{
fprintf(stderr,"Messaged function executing now\n");
protectedLauncher->didFinishLaunchingProcess(pid,sockets[0]);
});
}

void ProcessLauncher::terminateProcess()
Expand Down
16 changes: 16 additions & 0 deletions Source/WebKit/UIProcess/MiniBrowser.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this file?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its like a configuration file created by webkit for mini browser

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.device.usb</key>
<true/>
<key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
<string>com.apple.Safari.SafeBrowsing.Service</string>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.temporary-exception.files.absolute-path.read-only</key>
<string>/</string>
</dict>
</plist>
1 change: 0 additions & 1 deletion Source/WebKit/UIProcess/WebContextConnectionClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ void WebContextConnectionClient::didCreateConnection(WebProcessPool* processPool
{
if (!m_client.didCreateConnection)
return;

m_client.didCreateConnection(toAPI(processPool), toAPI(connection), m_client.base.clientInfo);
}

Expand Down
7 changes: 4 additions & 3 deletions Source/WebKit/UIProcess/WebPageProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -803,15 +803,15 @@ void WebPageProxy::swapToWebProcess(Ref<WebProcessProxy>&& process, std::unique_
void WebPageProxy::finishAttachingToWebProcess(ShouldInitializeWebPage shouldInitializePage)
{
ASSERT(m_process->state() != AuxiliaryProcessProxy::State::Terminated);

fprintf(stderr,"step1\n");
if (m_process->state() == AuxiliaryProcessProxy::State::Running) {
m_webProcessLifetimeTracker.webPageEnteringWebProcess();
processDidFinishLaunching();
}

updateActivityState();
updateThrottleState();

fprintf(stderr,"step2\n");
#if ENABLE(FULLSCREEN_API)
m_fullScreenManager = std::make_unique<WebFullScreenManagerProxy>(*this, pageClient().fullScreenManagerProxyClient());
#endif
Expand Down Expand Up @@ -847,9 +847,10 @@ void WebPageProxy::finishAttachingToWebProcess(ShouldInitializeWebPage shouldIni

clearInspectorTargets();
createInspectorTargets();

fprintf(stderr,"step3-1\n");
pageClient().didRelaunchProcess();
m_pageLoadState.didSwapWebProcesses();
fprintf(stderr,"step3\n");
m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
}

Expand Down
3 changes: 2 additions & 1 deletion Source/WebKit/UIProcess/haiku/BackingStoreHaiku.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ namespace WebKit {

void BackingStore::incorporateUpdate(ShareableBitmap* bitmap, const UpdateInfo& updateInfo)
{
fprintf(stderr,"Updater\n");
notImplemented();
}

void BackingStore::paint(BView* context,const IntRect& rect)
{
fprintf(stderr,"Im drawing");
//needs to be filled


}

Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/UIProcess/haiku/WebProcessPoolHaiku.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationPara

void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters& parameters)
{
fprintf(stderr,"YOLO");
fprintf(stderr,"YOLO webprocess\n");
notImplemented();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,5 @@ int main(int argc, char** argv)
/*#if USE(GCRYPT)
PAL::GCrypt::initialize();
#endif*/

return WebProcessMainUnix(argc, argv);
}
Loading