Sweeney Todd, the demon barber of Fleet Street made famous by the Stephen Sondheim/Hugh Wheeler musical, first made his appearance as a character in the anonymous penny-dreadful novel The String of Pearls, published in installments between 1846 and 1847.
However, stories of Londoners who murdered people and baked them into meat pies predated the publication of The String of Pearls. The urban legend appears in the Charles Dickens novel Martin Chuzzlewit (published 1843-1844), which includes a non-murderous barber named Poll Sweedlepipe.
In chapter 26 of Dickens's novel, we even learn of a "sympathy between beards and birds" that "frequently impels a shaver of the one to be a dealer in the other." Though Poll doesn't keep a green finch, linnet bird, nightingale, or blackbird, he does house gamecocks, bantams, owls, and smaller birds in the same building where he has his shop.
When Hablot Knight Browne (using the pseudonym "Phiz") illustrated Poll Sweedlepipe's shop, he included next to the "EASY SHAVING" and "HAIR DRESSED" advertisements (yup) signs for mutton pies. That's right! The barber was located right next to a shop that sold meat pies. Though there's no evidence in the novel that Dickens's barber is up to anything nefarious, Browne might have been alluding to a well-known folk belief.
And how widespread were Victorian tales of urban cannibalism? Well, Dickens alludes to them at the end of chapter 36 of Martin Chuzzlewit when the character Tom Pinch worries that his friend will think he has "strayed into one of those streets where the countrymen are murdered" and has "been made meat pies of, or some such horrible thing." Not letting the issue drop, Dickens begins the next chapter with the line: "Tom’s evil genius did not lead him into the dens of any of those preparers of cannibalic pastry, who are represented in many standard country legends as doing a lively retail business in the Metropolis."
What's interesting to me is that in Martin Chuzzlewit the urban legend of people being baked into meat pies is represented as having its origins in the country. It is only rural folks who believe such fantastic accounts of city dwellers feeding upon one another. Dickens was a city dweller himself, and he shows London as a place of opportunity for Tom Pinch rather than a location of danger.
The novel does contain other references to cannibalism, though, as when the innkeeper Mrs. Lupin regrets that a character went off to the United States rather than "to some of those countries which are not quite barbarous; where the savages eat each other fairly, and give an equal chance to every one!"
Well, as Mrs. Lovett and Sweeney sing, "How gratifying for once to know / That those above will serve those down below!"