China's main goal is to avoid perceptions that it has lost any degree of authority over events in Hong Kong, as that could exacerbate a number of its other challenges. Not too surprisingly, the Chinese government is weighing in with an unambiguous statement concerning its authority over Hong Kong. Reuters reported, "'Hong Kong is China's Hong Kong,' Foreign Ministry spokeswoman Hua Chunying defiantly told a news briefing in Beijing."
A muddled outcome or failure by the Chinese government to achieve its basic goals regarding the Hong Kong election could further intensify the separatist movement in China's Xinjiang Province and embolden terrorists there to increase the frequency and intensity of their attacks. It could also encourage other Asian states to take a tougher stand regarding China's moves over disputed territories and waters. China does not want to wind up in a worse geopolitical position on account of Hong Kong's events and I believe the Chinese government is very much focused on the larger picture. This, of course, makes significant concessions to the protesters very unlikely.
At the same time, an overly harsh response, could also have high to extreme costs. After having witnessed events related to Ukraine, the U.S. and European Union might be much more willing to reassess China's longer-term evolution and to slow economic cooperation. Failure to do so, in their view, could give incentives to Russian President Putin to become even more inflexible. A Tiananmen Square-type approach could lead to significant economic sanctions at a time when China is trying to sustain robust economic growth, avoid risks associated with some inflated regional real estate valuations, and address regional debt issues. Taiwan could suspend or even reverse some of its recent expanded cooperations with China and Taiwan's independence movement could gain new force. Asian states facing territorial disputes with China could seek much greater security collaboration with the United States and, if the U.S. concludes China is potentially evolving into a hostile actor, could be more willing to accommodate those concerns. The still vaguely defined U.S. "Asian Pivot" could also gain the kind of concreteness and specificity that has been lacking to date.
The anti-corruption drive you have cited is also an important element. Outside China there are questions as to whether the drive's goal is solely about stamping out corruption, helping President Xi consolidate power to an extent that some of his recent predecessors have not, or some combination. If part of the goal concerns political power consolidation, the Chinese President cannot afford to allow Hong Kong to defy his approach, even as he is constrained to some extent. A Tiananmen Square-type event would have far larger costs today than it did 25 years ago, given China's domestic and regional challenges (recent more volatile economic performance, growing terrorism in the Xinjiang Province, increasing East Asia rivalry over waters and islands, etc.). Therefore, I don't expect such an event barring a dramatic and sustained escalation of developments.
In the end, I believe the Chinese government will show some degree of patience, even as it seeks to display firmness and slowly ratchets up pressure on the protesters. I expect that China will pursue alternative measures to a harsh crackdown in coming days or weeks depending on the evolution of events, especially if cosmetic or symbolic concessions prove inadequate, but won't use massive force to break the protests in the near-term. At the same time, it will not compromise on its fundamental approach to handling Hong Kong's political affairs, as it believes it would have too much to lose in the larger domestic and geopolitical frameworks if it is perceived as displaying weakness.