Skip to content

RDKEMW-3523:Update rdkNativeScript with application identifiers#20

Merged
madanagopalt merged 1 commit into
developfrom
topic/RDKEMW-3523
May 9, 2025
Merged

RDKEMW-3523:Update rdkNativeScript with application identifiers#20
madanagopalt merged 1 commit into
developfrom
topic/RDKEMW-3523

Conversation

@Sid2001-maker
Copy link
Copy Markdown
Contributor

Reason for change: Cleaned up the code
Test Procedure: build should be successful.
Risks: low
Priority: P2

@Sid2001-maker Sid2001-maker requested a review from a team April 30, 2025 10:06
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 30, 2025

CLA assistant check
All committers have signed the CLA.

Comment thread include/NativeJSRenderer.h Outdated
RUNSCRIPT
};

struct applicationRequest
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rename as ApplicationRequest

Comment thread include/NativeJSRenderer.h Outdated
};
}
std::mutex mUserMutex;
struct applicationData{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rename as ApplicationData

@Sid2001-maker Sid2001-maker force-pushed the topic/RDKEMW-3523 branch 2 times, most recently from e4c61f9 to e54dbe2 Compare May 6, 2025 05:43
Comment thread include/NativeJSRenderer.h Outdated
};


struct applicationDetails{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Change name to ApplicationDetails (any struct or class need to start with upper case for words within it)

Comment thread src/NativeJSRenderer.cpp Outdated
#include <curl/curl.h>
#include <JavaScriptEngine.h>
#include <JavaScriptContext.h>
//#include <JavaScriptContext.h>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove this commented line

Comment thread src/jsruntime.cpp Outdated
}

renderer->run();
std::this_thread::sleep_for(std::chrono::milliseconds(100));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we avoid sleep?

Copy link
Copy Markdown
Contributor

@madanagopalt madanagopalt left a comment

Choose a reason for hiding this comment

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

kindly look at comments

@Sid2001-maker Sid2001-maker force-pushed the topic/RDKEMW-3523 branch 7 times, most recently from ba48605 to 4022c3c Compare May 9, 2025 06:27
Comment thread include/NativeJSRenderer.h Outdated
bool mEnableJSDOM;
bool mEnableWindow;
bool mEnablePlayer;
//ModuleSettings mModuleSettings;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove this commented line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changes done

Comment thread include/NativeJSRenderer.h Outdated
};
}
std::mutex mUserMutex;
struct ApplicationData{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Move structure outisde the class

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changes done

Comment thread src/NativeJSRenderer.cpp Outdated
}

void NativeJSRenderer::launchApplication(std::string url, ModuleSettings& moduleSettings)
uint32_t createID()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we keep it as private member function within class as createApplicationIdentifier

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changes done

Copy link
Copy Markdown
Contributor

@madanagopalt madanagopalt left a comment

Choose a reason for hiding this comment

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

kindly look at comments

Comment thread src/NativeJSRenderer.cpp Outdated
if (mapEntry != mContextMap.end())
{
JavaScriptContext* context = (JavaScriptContext*)mContextMap[id].context;
std::string* Url = &mContextMap[id].url;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what is need for this line?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changes done

Copy link
Copy Markdown
Contributor

@madanagopalt madanagopalt left a comment

Choose a reason for hiding this comment

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

kindly look at comments

Comment thread src/NativeJSRenderer.cpp Outdated
}

void NativeJSRenderer::launchApplication(std::string url, ModuleSettings& moduleSettings)
uint32_t createApplicationIdentifier()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This needs to be NativeJSRenderer::::createApplicationIdentifier

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changes done

Comment thread src/NativeJSRenderer.cpp Outdated
gPendingUrlRequests.push_back(request);
mUserMutex.unlock();
static uint32_t id = 1;
std::cout<<"Creating id: "<<id<<std::endl;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

his print can be removed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changes done

Comment thread src/NativeJSRenderer.cpp Outdated
mUserMutex.unlock();
static uint32_t id = 1;
std::cout<<"Creating id: "<<id<<std::endl;
return id++;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Convert this line as:

uint32_t ret = id;
id++;
return ret;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread src/NativeJSRenderer.cpp Outdated
ApplicationDetails appData;
appData.id = key;
appData.url = value.url;
std::cout<<"Found application with ID: "<<key<<" and url:"<<value.url<<std::endl;
Copy link
Copy Markdown
Contributor

@madanagopalt madanagopalt May 9, 2025

Choose a reason for hiding this comment

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

This print can be commented and mentioned as DEBUG level print. Same is applicable for print inside createApplication also

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread src/NativeJSRenderer.cpp Outdated
uint32_t id= appRequest.mId;

JavaScriptContextFeatures features(mEmbedThunderJS, mEmbedRdkWebBridge, mEnableWebSocketServer, settings);
JavaScriptContext* context = new JavaScriptContext(features, " " , mEngine);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Give empty string. The string passed here as single space

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread src/NativeJSRenderer.cpp Outdated
std::cerr<<"context not created for id: "<< id <<std::endl;
return ;
}
std::cout<<"Context created for id: "<<id<<std::endl;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Follow same as DEBUG comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changes done

Comment thread src/NativeJSRenderer.cpp Outdated
loadApplication(gPendingUrlRequests[i].mUrl, settings);

ApplicationRequest& request = gPendingRequests[i];
if(request.mRequestType == 0)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Compare wtih ENUM name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changes done

Comment thread src/NativeJSRenderer.cpp Outdated
ApplicationRequest& request = gPendingRequests[i];
if(request.mRequestType == 0)
{
NativeJSRenderer::createApplicationInternal(request);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We don't want namespace here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changes done

Copy link
Copy Markdown
Contributor

@madanagopalt madanagopalt left a comment

Choose a reason for hiding this comment

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

kindly look at comments

Reason for change: Cleaned up the code
Test Procedure: build should be successful.
Risks: low
Priority: P2
@madanagopalt madanagopalt merged commit 6a346ef into develop May 9, 2025
3 of 4 checks passed
@Sid2001-maker Sid2001-maker deleted the topic/RDKEMW-3523 branch February 18, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants