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

Ipc iteration2 #15

Merged
merged 3 commits into from Jun 7, 2019

Conversation

@RAJAGOPALAN-GANGADHARAN
Copy link

commented May 23, 2019

No description provided.

Message Listener attached to Workqueue thread first iteration
1)Added a message stashing feature so it stashes the messages and interprets them when the loop is ready to run
2)Now have to fix connection between network and webprocess
Fixed the worqueue ambiguity
This time used maps to store loopers and BApplications to forward message to appropriate loopers
fprintf(stderr,"\n******** %ld ---- ",getpid());
message->PrintToStream();
fprintf(stderr,"*********\n");
if(count == 1)

This comment has been minimized.

Copy link
@pulkomandy

pulkomandy May 23, 2019

Member

I'm not sure what you are trying to do here

This comment has been minimized.

Copy link
@RAJAGOPALAN-GANGADHARAN

RAJAGOPALAN-GANGADHARAN May 23, 2019

Author

Sorry I thought reply from another process was getting added to same message turns out it's just print to stream getting mixed up

}

RefPtr<SharedMemory> SharedMemory::allocate(size_t size)
{
void* baseAddress;
fprintf(stderr,"%s %ld\n",__PRETTY_FUNCTION__,size);
//size = ROUND_UP_TO_PAGE(size); if its not a multiple of a page then do this

This comment has been minimized.

Copy link
@pulkomandy

pulkomandy May 23, 2019

Member

not needed for create_area.

{

}

SharedMemory::~SharedMemory()
{

This comment has been minimized.

Copy link
@pulkomandy

pulkomandy May 23, 2019

Member

don't forget to delete the area here.

RefPtr<SharedMemory> memory = adoptRef(new SharedMemory);
memory->m_size = size;
memory->m_data = baseAddress;
memory->m_areaid = sharedArea;
}

RefPtr<SharedMemory> SharedMemory::map(const Handle& handle, Protection protection)
{

This comment has been minimized.

Copy link
@pulkomandy

pulkomandy May 23, 2019

Member

we will need this working soon. Have you read about areas and how they are used to share memory between two applications?

This comment has been minimized.

Copy link
@RAJAGOPALAN-GANGADHARAN

RAJAGOPALAN-GANGADHARAN May 23, 2019

Author

I guess they are used for bitmaps for now they are not important as we have to fix messages first

This comment has been minimized.

Copy link
@pulkomandy

pulkomandy May 23, 2019

Member

I'm not sure, then at least log something here so we know we have reached the point where webkit is trying to use this

}

RefPtr<SharedMemory> SharedMemory::map(const Handle& handle, Protection protection)
{

}

RefPtr<SharedMemory> SharedMemory::adopt(area_id area, size_t size, Protection protection)
{

This comment has been minimized.

Copy link
@pulkomandy

pulkomandy May 23, 2019

Member

I think you just need to set m_siwe, m_data and m_areaid here

This comment has been minimized.

Copy link
@RAJAGOPALAN-GANGADHARAN

RAJAGOPALAN-GANGADHARAN May 23, 2019

Author

Yes I guess have to first find the area

public:
BLooper* messageForward ;
status_t result;
map<string,BLooper*> proxy;

This comment has been minimized.

Copy link
@pulkomandy

pulkomandy May 23, 2019

Member

what happened to the idea of including the thread_id directly in the messages? it didn't work?

This comment has been minimized.

Copy link
@RAJAGOPALAN-GANGADHARAN

RAJAGOPALAN-GANGADHARAN May 23, 2019

Author

I didn't understand how passing pointers will work can you tell me again? In this method I store the looper pointer and uniquely identifiers so it will be helpful in case of multiple web process I guess

This comment has been minimized.

Copy link
@pulkomandy

pulkomandy May 23, 2019

Member

Instead of AddString("identifier", key) you can do AddPointer("identifier", looper). Then on the way back, you don't need a map.

This comment has been minimized.

Copy link
@RAJAGOPALAN-GANGADHARAN

RAJAGOPALAN-GANGADHARAN May 23, 2019

Author

Looper of the sending process?

This comment has been minimized.

Copy link
@pulkomandy

pulkomandy May 23, 2019

Member

no, the looper the message should be sent to. It needs to be given to the remote application that will send the messages (exactly as it is the case now for the key, right?)

message = DetachCurrentMessage();
if(!looper)
{
stash.AddMessage(message);

This comment has been minimized.

Copy link
@pulkomandy

pulkomandy May 23, 2019

Member

can you explain this? If the message is sent to an invalid target, can't we just ignore it?

This comment has been minimized.

Copy link
@RAJAGOPALAN-GANGADHARAN

RAJAGOPALAN-GANGADHARAN May 23, 2019

Author

I added this because if the intended process is not launched yet but other process starts sending messages we need to store them and once they are ready to go we pop one by one

This comment has been minimized.

Copy link
@pulkomandy

pulkomandy May 23, 2019

Member

Does this happen? And is it a problem if the messages get lost?

I think the process should be something like:

  • WebProcess is started
  • WebProcess sends a message to UI to tell its alive
  • UIProcess does not send anything until WebProcess is ready

So we should not get messages before everything is ready?

This comment has been minimized.

Copy link
@RAJAGOPALAN-GANGADHARAN

RAJAGOPALAN-GANGADHARAN May 23, 2019

Author

Yes the web process starts and then only ui process sends but in our case after we process starts only our application comes to life so we should not miss the first few messages

This comment has been minimized.

Copy link
@pulkomandy

pulkomandy May 23, 2019

Member

So we have an initialization order problem. Maybe the UI process needs to send a "I'm ready" message to the web process when it is ?

This comment has been minimized.

Copy link
@RAJAGOPALAN-GANGADHARAN

RAJAGOPALAN-GANGADHARAN May 23, 2019

Author

No I guess this is not a problem because when our process is ready to receive then we stash them actually ui process does the same within it stashes until the process is running when we say did finish launching then the messages are sent to processes until then it is stashed


String executablePathOfWebProcess()
{
return BString("./bin/WebProcess");
static NeverDestroyed<const String> WebKitWebProcessName("./bin/WebProcess");

This comment has been minimized.

Copy link
@pulkomandy

pulkomandy May 23, 2019

Member

still not using find_directory, environment variables, etc as it should. At least add a TODO comment to remember.

This comment has been minimized.

Copy link
@RAJAGOPALAN-GANGADHARAN

RAJAGOPALAN-GANGADHARAN May 23, 2019

Author

I used entry ref I guess I can't find it now where is it. for now since we are testing I stopped with minibrowser later we will add all the things.
Sure I will add a todo

IPC communication WIP
1) Created a message from ui process to network process that notifies the pid of webprocess
2) Successfully created networkconnectionToWebProcess
3) Replying back to webProcess is not working(to be fixed - i should probably take help from webkit people as im pretty lost)
@@ -27,6 +27,9 @@ messages -> NetworkProcess LegacyReceiver {
# Creates a connection for communication with a WebProcess
CreateNetworkConnectionToWebProcess(bool isServiceWorkerProcess, WebCore::RegistrableDomain registrableDomain)

#if PLATFORM(HAIKU)
CreateNetworkConnectionToWebProcessHaiku(bool isServiceWorkerProcess, WebCore::RegistrableDomain registrableDomain,int64_t webPID)

This comment has been minimized.

Copy link
@RAJAGOPALAN-GANGADHARAN

RAJAGOPALAN-GANGADHARAN May 28, 2019

Author

I felt this was necessary because the usual way other platform does it by creating a socket pair and taking server onto networkprocess and send the client as an attachment to webprocess. So we had to exchange our pid's.

@@ -83,6 +93,9 @@ class Attachment {
mach_msg_type_name_t disposition() const { return m_disposition; }
#elif OS(WINDOWS)
HANDLE handle() const { return m_handle; }
#elif PLATFORM(HAIKU)
team_id connectionID () const { return m_connectionID; }

This comment has been minimized.

Copy link
@RAJAGOPALAN-GANGADHARAN

RAJAGOPALAN-GANGADHARAN May 28, 2019

Author

encoder for long int is not provided maybe we should add it to Encoder? or we can manually encode required stuff in attachments

This comment has been minimized.

Copy link
@pulkomandy

pulkomandy May 28, 2019

Member

Casting the team_id to unsigned int or uint32_t should work. But you should be able to use a ProcessID as well here?

@pulkomandy pulkomandy merged commit 6bf81d7 into haiku:webkit2 Jun 7, 2019

@RAJAGOPALAN-GANGADHARAN RAJAGOPALAN-GANGADHARAN deleted the RAJAGOPALAN-GANGADHARAN:ipc-iteration2 branch Jun 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.