def handleViewChanges(self):
        self.toDoToViewQueueLock.acquire()
        while len(self.toDoToViewQueue) > 0:
            toDo = self.toDoToViewQueue.pop(0)
            if len(toDo) == 2:
                self.logger.debug('Handling view change %s with size %d payload' % (base.numeric_to_symbolic[toDo[0]], len(toDo[1])))
                if (toDo[0] == base.SHARE_VIEW) or (toDo[0] == base.RESHARE_VIEW):
                    self.totalNewViewSize = 0
                    if toDo[0] == base.SHARE_VIEW:
                        self.view = sublime.active_window().new_file()
                        payloadBits = toDo[1].split('|')
                        if payloadBits[0] == 'NONAME':
                            self.view.set_name('SHARING-WITH-%s' % self.sharingWithUser)
                        else:
                            self.view.set_name(payloadBits[0])
                        self.totalNewViewSize = int(payloadBits[1])
                    else:
                        # resync event, purge the old view in preparation for the fresh content
                        self.logger.debug('resyncing view')
                        self.lastResyncdPosition = 0
                        self.totalNewViewSize = int(toDo[1])
                    self.view.set_read_only(True)
                    self.view.set_scratch(True)
                    status_bar.progress_message("receiving view from %s" % self.sharingWithUser, self.view.size(), self.totalNewViewSize)
                elif toDo[0] == base.VIEW_CHUNK:
                    self.view.set_read_only(False)
                    self.viewPopulateEdit = self.view.begin_edit()
                    # if we are a resync chunk...
                    if hasattr(self, 'lastResyncdPosition'):
                        self.view.replace(self.viewPopulateEdit,  \
                            sublime.Region(self.lastResyncdPosition, self.lastResyncdPosition + len(toDo[1])), \
                            toDo[1])
                        self.lastResyncdPosition += len(toDo[1])
                    else:
                        self.view.insert(self.viewPopulateEdit, self.view.size(), toDo[1])
                    self.view.end_edit(self.viewPopulateEdit)
                    self.viewPopulateEdit = None
                    self.view.set_read_only(True)
                    status_bar.progress_message("receiving view from %s" % self.sharingWithUser, self.view.size(), self.totalNewViewSize)
                elif toDo[0] == base.END_OF_VIEW:
                    self.view.set_syntax_file(toDo[1])
                    if hasattr(self, 'lastResyncdPosition'):
                        del self.lastResyncdPosition
                    status_bar.progress_message("receiving view from %s" % self.sharingWithUser, self.view.size(), self.totalNewViewSize)
                    # view is populated and configured, lets share!
                    self.onStartCollab()
                elif toDo[0] == base.SELECTION:
                    status_bar.heartbeat_message('sharing with %s' % self.str())
                    regions = []
                    for regionMatch in REGION_PATTERN.finditer(toDo[1]):
                        regions.append(sublime.Region(int(regionMatch.group(1)), int(regionMatch.group(2))))
                    self.recvSelectionUpdate(regions)
                elif toDo[0] == base.POSITION:
                    status_bar.heartbeat_message('sharing with %s' % self.str())
                    regionMatch = REGION_PATTERN.search(toDo[1])
                    if regionMatch:
                        self.recvViewPositionUpdate(sublime.Region(int(regionMatch.group(1)), int(regionMatch.group(2))))
            elif len(toDo) == 3:
                status_bar.heartbeat_message('sharing with %s' % self.str())
                # edit event
                assert toDo[0] == base.EDIT
                # make the shared selection the ACTUAL selection
                self.view.sel().clear()
                for region in self.view.get_regions(self.sharingWithUser):
                    self.view.sel().add(region)
                self.view.erase_regions(self.sharingWithUser)
                self.recvEdit(toDo[1], toDo[2])
        self.toDoToViewQueueLock.release()
Serialize a GameRecord object.
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/sub_collab/peer/basic.py/BasicPeer.handleViewChanges--crossover with--dataset/ETHPy150Open Morgawr/gogonlinux/gog_utils/gog_db.py/GameRecord.serialize