This circuit is sometimes referred to as the "Auctioneer effect" - highest voltage wins!
as DC power (wall-wart) is applied from the switch,
the first diode passes the supply voltage minus the voltage drop from a silicone diode (~0.7 volts).
as long as the secondary backup supply (batter) is below the primary supply, the second diode is reversed biased at the cathode. when power is lost at the primary DC side, the second diode is now forward biased and passes the backup battery voltage to the circuit.
This happens very fast and little power is lost during the diode transition.