The social media giant is planning to slash about 10% of its workforce even as its digital ad revenue continues to climb.