Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4787b3c1 authored by Steve Block's avatar Steve Block Committed by Android (Google) Code Review
Browse files

Merge "Adds synchronization around message handler in GeolocationPermissions and WebStorage"

parents b52188ee e4b2d4dc
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -126,7 +126,7 @@ public final class GeolocationPermissions {
     * Creates the message handler. Must be called on the WebKit thread.
     * Creates the message handler. Must be called on the WebKit thread.
     * @hide
     * @hide
     */
     */
    public void createHandler() {
    public synchronized void createHandler() {
        if (mHandler == null) {
        if (mHandler == null) {
            mHandler = new Handler() {
            mHandler = new Handler() {
                @Override
                @Override
@@ -180,7 +180,7 @@ public final class GeolocationPermissions {
    /**
    /**
     * Utility function to send a message to our handler.
     * Utility function to send a message to our handler.
     */
     */
    private void postMessage(Message msg) {
    private synchronized void postMessage(Message msg) {
        assert(mHandler != null);
        assert(mHandler != null);
        mHandler.sendMessage(msg);
        mHandler.sendMessage(msg);
    }
    }
+2 −2
Original line number Original line Diff line number Diff line
@@ -146,7 +146,7 @@ public final class WebStorage {
     * @hide
     * @hide
     * Message handler, webcore side
     * Message handler, webcore side
     */
     */
    public void createHandler() {
    public synchronized void createHandler() {
        if (mHandler == null) {
        if (mHandler == null) {
            mHandler = new Handler() {
            mHandler = new Handler() {
                @Override
                @Override
@@ -342,7 +342,7 @@ public final class WebStorage {
    /**
    /**
     * Utility function to send a message to our handler
     * Utility function to send a message to our handler
     */
     */
    private void postMessage(Message msg) {
    private synchronized void postMessage(Message msg) {
        if (mHandler != null) {
        if (mHandler != null) {
            mHandler.sendMessage(msg);
            mHandler.sendMessage(msg);
        }
        }