1// Copyright (c) 2011 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "base/win/wrapped_window_proc.h"
6
7#include "base/atomicops.h"
8
9namespace {
10
11base::win::WinProcExceptionFilter s_exception_filter = NULL;
12
13}  // namespace.
14
15namespace base {
16namespace win {
17
18WinProcExceptionFilter SetWinProcExceptionFilter(
19    WinProcExceptionFilter filter) {
20  subtle::AtomicWord rv = subtle::NoBarrier_AtomicExchange(
21      reinterpret_cast<subtle::AtomicWord*>(&s_exception_filter),
22      reinterpret_cast<subtle::AtomicWord>(filter));
23  return reinterpret_cast<WinProcExceptionFilter>(rv);
24}
25
26int CallExceptionFilter(EXCEPTION_POINTERS* info) {
27  return s_exception_filter ? s_exception_filter(info) :
28                              EXCEPTION_CONTINUE_SEARCH;
29}
30
31}  // namespace win
32}  // namespace base
33