Package com.google.speedtracer.client.messages

Examples of com.google.speedtracer.client.messages.RequestInitializationMessage


           * initialization from the background page. It is essentially asking
           * for us to give it a DataInstance and TabDescription.
           */
          private void doRequestInitialization(final Client channel,
              WindowChannel.Message data) {
            final RequestInitializationMessage request = data.cast();
            final int tabId = request.getTabId();
            final int browserId = request.getBrowserId();
            final BrowserConnectionState browserConnection = browserConnectionMap.get(browserId);
            assert (browserConnection != null);

            // Extract the relevant DataInstance and TabDescription
            // that we have stashed.
            final TabModel tabModel = browserConnection.tabMap.get(tabId);
            // Store a reference to the channel in case we want to
            // send messages later.
            tabModel.channel = channel;

            // We are talking to another browser. Go ahead and initialize
            // the window since the interaction was started externally.
            assert (tabModel.tabDescription != null);
            assert (tabModel.dataInstance != null);

            final InitializeMonitorMessage initializeMessage = InitializeMonitorMessage.create(
                tabModel.tabDescription, tabModel.dataInstance, getVersion());
            channel.sendMessage(InitializeMonitorMessage.TYPE,
                initializeMessage);

            // If we are talking to chrome, update the pageAction Icon and
            // wait for a second click to initialize the monitor.
            if (browserId == CHROME_BROWSER_ID) {
              // We now change the page action icon. This signals that the
              // next time it is clicked, we should initialize.
              setBrowserActionIcon(tabId, browserAction.mtIconActive(),
                  tabModel);
            }

            // Hook unload so we can close down and keep track of monitor
            // state.
            request.getMonitorWindow().addUnloadListener(new EventListener() {
              public void handleEvent(Event event) {
                TabModel tabModel = browserConnection.tabMap.get(tabId);
                channel.close();
                tabModel.channel = null;
                tabModel.monitorClosed = true;
                tabModel.dataInstance.unload();
                tabModel.dataInstance = null;
                setBrowserActionIcon(tabId, browserAction.mtIcon(), tabModel);
                browserConnection.tabMap.remove(tabModel);
              }
            });

            if (tabModel.monitorOpenedCallback != null) {
              tabModel.monitorOpenedCallback.monitorOpened();
              tabModel.monitorOpenedCallback = null;
            }
          }

          private void doResetBaseTime(WindowChannel.Message data) {
            final ResetBaseTimeMessage request = data.cast();
            final int tabId = request.getTabId();
            final int browserId = request.getBrowserId();
            final BrowserConnectionState browserConnection = browserConnectionMap.get(browserId);
            final TabModel tabModel = browserConnection.tabMap.get(tabId);
            DataInstance dataInstance = tabModel.dataInstance;
            dataInstance.setBaseTime(-1);
          }
View Full Code Here

TOP

Related Classes of com.google.speedtracer.client.messages.RequestInitializationMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.