Add NULL pointer checks.

BUG=318427
R=alecflett@chromium.org,abarth@chromium.org

Review URL: https://codereview.chromium.org/90523002

git-svn-id: svn://svn.chromium.org/blink/trunk@162795 bbb929c8-8fbe-4397-9dbb-9b2b20218538
[websql] Move the DatabaseThread to the WebThread API

This should also fix a failing assertion in WorkerThread where tasks
referencing closed databases are still hanging around: The database
thread doesn't referenced itself anymore, and drains the message queue
in its destructor.

BUG=323858,323858,301515
R=michaeln@chromium.org,abarth@chromium.org

Review URL: https://codereview.chromium.org/91113004

git-svn-id: svn://svn.chromium.org/blink/trunk@162796 bbb929c8-8fbe-4397-9dbb-9b2b20218538